diff --git a/types/react-blessed/index.d.ts b/types/react-blessed/index.d.ts index 2a1c02bd6e..33c9fe2790 100644 --- a/types/react-blessed/index.d.ts +++ b/types/react-blessed/index.d.ts @@ -4,51 +4,13 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -declare module 'react-blessed' { - import * as React from 'react'; - import * as Blessd from 'blessed'; - import { Widgets, screen } from 'blessed'; - export type Callback = () => void | null | undefined; - export type renderer = ( - c: JSX.Element, s: Widgets.Screen, callback?: Callback, - ) => React.Component | null; - export function render( - c: JSX.Element, s: Widgets.Screen, callback?: Callback - ): React.Component | null; - export function createBlessedRenderer(b: typeof Blessd): renderer; - } - - // relation to blessed export widgets, prepare for next version of react-blessed - declare namespace JSX { - interface IntrinsicElements { - 'blessed-box': any, - 'blessed-text': any, - 'blessed-line': any, - 'blessed-scrollablebox': any, - 'blessed-scrollabletext': any, - 'blessed-bigtext': any, - 'blessed-list': any, - 'blessed-filemanager': any, - 'blessed-listtable': any, - 'blessed-listbar': any, - 'blessed-form': any, - 'blessed-input': any, - 'blessed-textarea': any, - 'blessed-textbox': any, - 'blessed-button': any, - 'blessed-checkbox': any, - 'blessed-radioset': any, - 'blessed-radiobutton': any, - 'blessed-table': any, - 'blessed-prompt': any, - 'blessed-question': any, - 'blessed-message': any, - 'blessed-loading': any, - 'blessed-log': any, - 'blessed-progressbar': any, - 'blessed-program': any, - 'blessed-terminal': any, - 'blessed-layout': any, - 'blessed-escape': any, - } - } +import * as React from 'react'; +import { Widgets, screen } from 'blessed'; +export type Callback = () => void | null | undefined; +export type renderer = ( + c: JSX.Element, s: Widgets.Screen, callback?: Callback, +) => React.Component | null; +export function render( + c: JSX.Element, s: Widgets.Screen, callback?: Callback +): React.Component | null; +export function createBlessedRenderer(bls: any): renderer; diff --git a/types/react-blessed/react-blessed-tests.tsx b/types/react-blessed/react-blessed-tests.tsx index 90cabcc765..5ac0ac073c 100644 --- a/types/react-blessed/react-blessed-tests.tsx +++ b/types/react-blessed/react-blessed-tests.tsx @@ -125,8 +125,10 @@ class Progress extends Component { super(props); const interval: NodeJS.Timer = setInterval(() => { const { progress } = this.state; - if (this.state.progress >= 100) - return clearInterval(interval); + if (this.state.progress >= 100) { + clearInterval(interval); + return; + } this.setState({ progress: progress + 1, }); diff --git a/types/react-blessed/react.d.ts b/types/react-blessed/react.d.ts new file mode 100644 index 0000000000..4344c2a871 --- /dev/null +++ b/types/react-blessed/react.d.ts @@ -0,0 +1,34 @@ +// relation to blessed export widgets, prepare for next version of react-blessed +declare namespace JSX { + interface IntrinsicElements { + 'blessed-box': any; + 'blessed-text': any; + 'blessed-line': any; + 'blessed-scrollablebox': any; + 'blessed-scrollabletext': any; + 'blessed-bigtext': any; + 'blessed-list': any; + 'blessed-filemanager': any; + 'blessed-listtable': any; + 'blessed-listbar': any; + 'blessed-form': any; + 'blessed-input': any; + 'blessed-textarea': any; + 'blessed-textbox': any; + 'blessed-button': any; + 'blessed-checkbox': any; + 'blessed-radioset': any; + 'blessed-radiobutton': any; + 'blessed-table': any; + 'blessed-prompt': any; + 'blessed-question': any; + 'blessed-message': any; + 'blessed-loading': any; + 'blessed-log': any; + 'blessed-progressbar': any; + 'blessed-program': any; + 'blessed-terminal': any; + 'blessed-layout': any; + 'blessed-escape': any; + } +} diff --git a/types/react-blessed/tsconfig.json b/types/react-blessed/tsconfig.json index 46c89eec29..6195735ac9 100644 --- a/types/react-blessed/tsconfig.json +++ b/types/react-blessed/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "react.d.ts", "react-blessed-tests.tsx" ] }