UNPKG

1.08 kBTypeScriptView Raw
1// Type definitions for pify 5.0
2// Project: https://github.com/sindresorhus/pify
3// Definitions by: Sam Verschueren <https://github.com/samverschueren>
4// Michael Müller <https://github.com/mad-mike>
5// Christoph Müller <https://github.com/c7hm4r>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
8type InputFunction = (...args: any[]) => any;
9
10declare function pify(input: InputFunction, options?: pify.PifyOptions): (...args: any[]) => Promise<any>;
11declare function pify(input: object, options?: pify.PifyOptions): any;
12
13declare namespace pify {
14 interface PifyOptions {
15 multiArgs?: boolean | undefined;
16 include?: Array<string | RegExp> | undefined;
17 exclude?: Array<string | RegExp> | undefined;
18 excludeMain?: boolean | undefined;
19 errorFirst?: boolean | undefined;
20 promiseModule?: PromiseModule | undefined;
21 }
22
23 interface PromiseModule {
24 new (executor: (resolve: (value?: any) => void, reject: (reason?: any) => void) => void): any;
25 }
26}
27
28export = pify;