Added type definitions for react-text-truncate

This commit is contained in:
Adrien Antoine
2019-03-18 14:04:19 +00:00
parent 706d838bd3
commit 391c85bbfe
4 changed files with 68 additions and 0 deletions

24
types/react-text-truncate/index.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
// Type definitions for react-text-truncate 0.14
// Project: https://github.com/ShinyChang/react-text-truncate
// Definitions by: Adrien Antoine <https://github.com/adriantoine>
// 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<TextTruncateProps> {}
export default TextTruncate;

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import TextTruncate from 'react-text-truncate';
const TruncatedText = () => (
<TextTruncate
text="My Text"
line={2}
containerClassName="my-container"
element="span"
onCalculated={() => {}}
onTruncated={() => {}}
onToggled={(truncate: boolean) => {}}
textElement={<div />}
textTruncateChild={<div />}
truncateText="..."
maxCalculateTimes={5}
/>
);

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }