Add types for 'promisify-node' (#12386)

* Added types for 'promisify-node'

* Optional boolean param instead of default value
This commit is contained in:
Borek Bernard
2016-11-02 22:30:06 +09:00
committed by Masahiro Wakame
parent 1ebf11b4eb
commit e88fdefc17
3 changed files with 43 additions and 0 deletions
+17
View File
@@ -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;
+7
View File
@@ -0,0 +1,7 @@
import promisify = require('promisify-node');
let fs = promisify('fs');
fs.readFile('example.txt').then((content: any) => {
console.log(content);
});
+19
View File
@@ -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"
]
}