mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-15 14:30:22 +00:00
Add types for 'promisify-node' (#12386)
* Added types for 'promisify-node' * Optional boolean param instead of default value
This commit is contained in:
committed by
Masahiro Wakame
parent
1ebf11b4eb
commit
e88fdefc17
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for promisify-node 0.4.0
|
||||
// Project: https://github.com/nodegit/promisify-node
|
||||
// Definitions by: Borek Bernard <https://github.com/borekb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
export = promisify;
|
||||
|
||||
/**
|
||||
* Public API for Promisify. Will resolve modules names using `require`.
|
||||
*
|
||||
* @param {*} name - Can be a module name, object, or function.
|
||||
* @param {Function} test - Optional function to identify async methods.
|
||||
* @param {Boolean} noMutate - Optional set to true to avoid mutating the target.
|
||||
* @returns {*} exports - The resolved value from require or passed in value.
|
||||
*/
|
||||
declare function promisify(name: string | Object | Function, test?: Function, noMutate?: boolean): any;
|
||||
@@ -0,0 +1,7 @@
|
||||
import promisify = require('promisify-node');
|
||||
|
||||
let fs = promisify('fs');
|
||||
|
||||
fs.readFile('example.txt').then((content: any) => {
|
||||
console.log(content);
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"promisify-node-tests"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user