diff --git a/types/react-typist/index.d.ts b/types/react-typist/index.d.ts new file mode 100644 index 0000000000..a43c195188 --- /dev/null +++ b/types/react-typist/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for react-typist 2.0 +// Project: https://github.com/jstejada/react-typist#readme +// Definitions by: Shawn Choi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +import * as React from "react"; + +export namespace TreeView { + interface CursorProps { + show?: boolean; + blink?: boolean; + element?: string; + hideWhenDone?: boolean; + hideWhenDoneDelay?: number; + } + + interface CurrentTextProps { + line: string; + lineIdx: number; + character: string; + charIdx: number; + defDelayGenerator: ( + mn: number, + st: number + ) => (...params: any) => number; + } + + interface DelayProps { + ms: number; + } + class Delay extends React.Component {} + + interface BackSpaceProps { + count?: number; + delay?: number; + } + class Backspace extends React.Component {} +} + +export interface TreeViewProps { + className?: string; + avgTypingDelay?: number; + stdTypingDelay?: number; + startDelay?: number; + cursor?: TreeView.CursorProps; + onCharacterTyped?: (char: string, charIndex: number) => void; + onLineTyped?: (line: string, lineIndex: number) => void; + onTypingDone?: () => void; + delayGenerator?: ( + mean: number, + std: number, + current: TreeView.CurrentTextProps + ) => number; +} + +export class TreeView extends React.Component {} + +export default TreeView; diff --git a/types/react-typist/react-typist-tests.tsx b/types/react-typist/react-typist-tests.tsx new file mode 100644 index 0000000000..c3c7de0f0d --- /dev/null +++ b/types/react-typist/react-typist-tests.tsx @@ -0,0 +1,59 @@ +import * as React from "react"; +import Typist from "react-typist"; + +class ReactTypist extends React.Component { + state = { + renderMsg: false + }; + + onHeaderTyped = () => { + this.setState({ renderMsg: true }); + } + + render() { + const docs = "//github.com/jstejada/react-typist"; + return ( +
+ + React Typist + +
+ {this.state.renderMsg ? ( + + * Easy to style + +
+ * Easy to customize + +
+ * Easy to use backp + + sace + + + space + +
+ + *{" "} + + docs + + +
+ {""} +
+ ) : null} +
+
+ ); + } +} diff --git a/types/react-typist/tsconfig.json b/types/react-typist/tsconfig.json new file mode 100644 index 0000000000..033774364c --- /dev/null +++ b/types/react-typist/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-typist-tests.tsx" + ] +} diff --git a/types/react-typist/tslint.json b/types/react-typist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-typist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }