From fb472e63164fc5e6506ed0ae0a1e494417d3b9fe Mon Sep 17 00:00:00 2001 From: Jakub Czyzewski Date: Tue, 15 Jan 2019 16:57:25 +0100 Subject: [PATCH 1/2] [react-dotdotdot] Add types --- types/react-dotdotdot/index.d.ts | 21 ++++++++++++++++ .../react-dotdotdot/react-dotdotdot-tests.tsx | 20 +++++++++++++++ types/react-dotdotdot/tsconfig.json | 25 +++++++++++++++++++ types/react-dotdotdot/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/react-dotdotdot/index.d.ts create mode 100644 types/react-dotdotdot/react-dotdotdot-tests.tsx create mode 100644 types/react-dotdotdot/tsconfig.json create mode 100644 types/react-dotdotdot/tslint.json diff --git a/types/react-dotdotdot/index.d.ts b/types/react-dotdotdot/index.d.ts new file mode 100644 index 0000000000..c385061d56 --- /dev/null +++ b/types/react-dotdotdot/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for react-dotdotdot 1.2 +// Project: https://github.com/CezaryDanielNowak/React-dotdotdot +// Definitions by: Jakub Czyżewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { ComponentType } from 'react'; + +interface DotDotDotProps { + clamp: number | string | boolean; + useNativeClamp?: boolean; + splitOnChars?: string[]; + animate?: boolean; + truncationChar?: string; + truncationHTML?: string; + tagName?: string; +} + +declare const Dotdotdot: ComponentType; + +export default Dotdotdot; diff --git a/types/react-dotdotdot/react-dotdotdot-tests.tsx b/types/react-dotdotdot/react-dotdotdot-tests.tsx new file mode 100644 index 0000000000..9168c30dba --- /dev/null +++ b/types/react-dotdotdot/react-dotdotdot-tests.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import Dotdotdot from 'react-dotdotdot'; +import * as ReactDOM from "react-dom"; + +ReactDOM.render( + +

+ Long, long
+ content,
+ 3 lines
+ will be shown. +

+
, document.body); diff --git a/types/react-dotdotdot/tsconfig.json b/types/react-dotdotdot/tsconfig.json new file mode 100644 index 0000000000..4112bcce99 --- /dev/null +++ b/types/react-dotdotdot/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-dotdotdot-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-dotdotdot/tslint.json b/types/react-dotdotdot/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dotdotdot/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 466965928b765e664623e8749529b1abe3107e3a Mon Sep 17 00:00:00 2001 From: Jakub Czyzewski Date: Tue, 22 Jan 2019 08:58:31 +0100 Subject: [PATCH 2/2] Use export= in react-dotdotdot typings --- types/react-dotdotdot/index.d.ts | 2 +- types/react-dotdotdot/tsconfig.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-dotdotdot/index.d.ts b/types/react-dotdotdot/index.d.ts index c385061d56..0522d11590 100644 --- a/types/react-dotdotdot/index.d.ts +++ b/types/react-dotdotdot/index.d.ts @@ -18,4 +18,4 @@ interface DotDotDotProps { declare const Dotdotdot: ComponentType; -export default Dotdotdot; +export = Dotdotdot; diff --git a/types/react-dotdotdot/tsconfig.json b/types/react-dotdotdot/tsconfig.json index 4112bcce99..e2267fd6bb 100644 --- a/types/react-dotdotdot/tsconfig.json +++ b/types/react-dotdotdot/tsconfig.json @@ -16,7 +16,8 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "jsx": "react" + "jsx": "react", + "esModuleInterop": true }, "files": [ "index.d.ts",