diff --git a/types/react-text-truncate/index.d.ts b/types/react-text-truncate/index.d.ts new file mode 100644 index 0000000000..d0eca2e4a4 --- /dev/null +++ b/types/react-text-truncate/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-text-truncate 0.14 +// Project: https://github.com/ShinyChang/react-text-truncate +// Definitions by: Adrien Antoine +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from 'react'; + +export interface TextTruncateProps { + containerClassName?: string; + element?: string; + line?: number | boolean; + onCalculated?: () => void; + onTruncated?: () => void; + onToggled?: (truncated: boolean) => void; + text?: string; + textElement?: React.ReactNode; + textTruncateChild?: React.ReactNode; + truncateText?: string; + maxCalculateTimes?: number; +} + +declare class TextTruncate extends React.Component {} + +export default TextTruncate; diff --git a/types/react-text-truncate/react-text-truncate-tests.tsx b/types/react-text-truncate/react-text-truncate-tests.tsx new file mode 100644 index 0000000000..b5c77ee28f --- /dev/null +++ b/types/react-text-truncate/react-text-truncate-tests.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import TextTruncate from 'react-text-truncate'; + +const TruncatedText = () => ( + {}} + onTruncated={() => {}} + onToggled={(truncate: boolean) => {}} + textElement={
} + textTruncateChild={
} + truncateText="..." + maxCalculateTimes={5} + /> +); diff --git a/types/react-text-truncate/tsconfig.json b/types/react-text-truncate/tsconfig.json new file mode 100644 index 0000000000..9dd3530bc3 --- /dev/null +++ b/types/react-text-truncate/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-text-truncate-tests.tsx" + ] +} diff --git a/types/react-text-truncate/tslint.json b/types/react-text-truncate/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-text-truncate/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }