From 16ae5fd3c417b5d0d8d00a744e7099754a72b8f2 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Sat, 18 Jan 2020 05:40:06 +1300 Subject: [PATCH] feat: Add typings for universalify (#41546) Signed-off-by: Richie Bendall --- types/universalify/index.d.ts | 7 +++++++ types/universalify/tsconfig.json | 23 +++++++++++++++++++++++ types/universalify/tslint.json | 1 + types/universalify/universalify-tests.ts | 4 ++++ 4 files changed, 35 insertions(+) create mode 100644 types/universalify/index.d.ts create mode 100644 types/universalify/tsconfig.json create mode 100644 types/universalify/tslint.json create mode 100644 types/universalify/universalify-tests.ts diff --git a/types/universalify/index.d.ts b/types/universalify/index.d.ts new file mode 100644 index 0000000000..ca1c441be0 --- /dev/null +++ b/types/universalify/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for universalify 0.1 +// Project: https://github.com/RyanZim/universalify#readme +// Definitions by: Richie Bendall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function fromCallback(fn: (...args: any[]) => any): (...args: any[]) => Promise | void; +export function fromPromise(fn: (...args: any[]) => any): (...args: any[]) => Promise | void; diff --git a/types/universalify/tsconfig.json b/types/universalify/tsconfig.json new file mode 100644 index 0000000000..899e898c06 --- /dev/null +++ b/types/universalify/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "universalify-tests.ts" + ] +} diff --git a/types/universalify/tslint.json b/types/universalify/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/universalify/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/universalify/universalify-tests.ts b/types/universalify/universalify-tests.ts new file mode 100644 index 0000000000..9cf4de6935 --- /dev/null +++ b/types/universalify/universalify-tests.ts @@ -0,0 +1,4 @@ +import universalify = require("universalify"); + +universalify.fromCallback(() => { }); // $ExpectType (...args: any[]) => void | Promise +universalify.fromPromise(() => { }); // $ExpectType (...args: any[]) => void | Promise