feat: Add typings for universalify (#41546)

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2020-01-18 05:40:06 +13:00 committed by Eli Barzilay
parent 3a13a0d024
commit 16ae5fd3c4
4 changed files with 35 additions and 0 deletions

7
types/universalify/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Type definitions for universalify 0.1
// Project: https://github.com/RyanZim/universalify#readme
// Definitions by: Richie Bendall <https://github.com/Richienb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function fromCallback(fn: (...args: any[]) => any): (...args: any[]) => Promise<any> | void;
export function fromPromise(fn: (...args: any[]) => any): (...args: any[]) => Promise<any> | void;

View File

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

View File

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

View File

@ -0,0 +1,4 @@
import universalify = require("universalify");
universalify.fromCallback(() => { }); // $ExpectType (...args: any[]) => void | Promise<any>
universalify.fromPromise(() => { }); // $ExpectType (...args: any[]) => void | Promise<any>