diff --git a/promisify-node/index.d.ts b/promisify-node/index.d.ts new file mode 100644 index 0000000000..ed50550321 --- /dev/null +++ b/promisify-node/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for promisify-node 0.4.0 +// Project: https://github.com/nodegit/promisify-node +// Definitions by: Borek Bernard +// 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; diff --git a/promisify-node/promisify-node-tests.ts b/promisify-node/promisify-node-tests.ts new file mode 100644 index 0000000000..2780e8775b --- /dev/null +++ b/promisify-node/promisify-node-tests.ts @@ -0,0 +1,7 @@ +import promisify = require('promisify-node'); + +let fs = promisify('fs'); + +fs.readFile('example.txt').then((content: any) => { + console.log(content); +}); diff --git a/promisify-node/tsconfig.json b/promisify-node/tsconfig.json new file mode 100644 index 0000000000..3ee5061fee --- /dev/null +++ b/promisify-node/tsconfig.json @@ -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" + ] +}