Adds type definitions for 'promise-nodeify' (#36091)

* Adds type definitions for 'promise-nodeify'

Adds type definitions and tests
Adds tsconfig and tslint config

* Fixes method signature on promiseNodeify.nodeifyThis()
This commit is contained in:
jgeth
2019-12-18 14:56:47 +00:00
committed by Orta
parent 1643a0be54
commit b6857e61e7
4 changed files with 56 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for promise-nodeify 3.0
// Project: https://github.com/kevinoid/promise-nodeify
// Definitions by: jgeth <https://github.com/jgeth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace promiseNodeify;
declare const promiseNodeify: {
<T>(
promise: Promise<T>,
callback: (error: Error | undefined, value: T | undefined) => any
): Promise<T> | undefined;
delegated<T>(
promise: Promise<T>,
callback: (error: Error | undefined, value: T | undefined) => any
): Promise<T> | undefined;
nodeifyThis<T>(
callback: (error: Error | undefined, value: T | undefined) => any
): Promise<T> | undefined;
};
export = promiseNodeify;
@@ -0,0 +1,8 @@
import * as promiseNodeify from "promise-nodeify";
const promise = new Promise<any>((resolve, reject) => {});
const callback = () => {};
promiseNodeify(promise, callback);
promiseNodeify.delegated(promise, callback);
promiseNodeify.nodeifyThis(callback);
+23
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",
"promise-nodeify-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }