From d113bbc18a95346a55749bab15f554f19e4d75be Mon Sep 17 00:00:00 2001 From: Kerwyn Date: Wed, 11 Apr 2018 17:15:58 -0600 Subject: [PATCH] Added type definitions for react-timeout (#24916) * Added type definitions for react-timeout * Fixed export * Removed rules from tslint.json * Added types * Indented * Fixed types --- types/react-timeout/index.d.ts | 32 +++++++++++++++++++++++++++++++ types/react-timeout/tsconfig.json | 23 ++++++++++++++++++++++ types/react-timeout/tslint.json | 3 +++ 3 files changed, 58 insertions(+) create mode 100644 types/react-timeout/index.d.ts create mode 100644 types/react-timeout/tsconfig.json create mode 100644 types/react-timeout/tslint.json diff --git a/types/react-timeout/index.d.ts b/types/react-timeout/index.d.ts new file mode 100644 index 0000000000..b214318a23 --- /dev/null +++ b/types/react-timeout/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-timeout 1.1 +// Project: https://github.com/plougsgaard/react-timeout +// Definitions by: Kerwyn Rojas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +import * as React from 'react'; + +export = ReactTimeout; + +declare function ReactTimeout( + SourceComponent: React.ComponentClass | React.StatelessComponent +): React.ComponentClass; + +declare namespace ReactTimeout { + type Timer = NodeJS.Timer | number; + + type Id = number; + + interface ReactTimeoutProps { + setTimeout?: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timer; + clearTimeout?: (timer: Timer) => void; + setInterval?: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Id; + clearInterval?: (id: Id) => void; + setImmediate?: (callback: (...args: any[]) => void, ...args: any[]) => Id; + clearImmediate?: (id: Id) => void; + requestAnimationFrame?: (callback: (...args: any[]) => void) => Id; + cancelAnimationFrame?: (id: Id) => void; + } +} diff --git a/types/react-timeout/tsconfig.json b/types/react-timeout/tsconfig.json new file mode 100644 index 0000000000..71e6b79545 --- /dev/null +++ b/types/react-timeout/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} diff --git a/types/react-timeout/tslint.json b/types/react-timeout/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-timeout/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}