1 |
|
2 |
|
3 | import util = require("util");
|
4 |
|
5 | import polyfill = require("./implementation");
|
6 | import getUtilPromisify = require("./polyfill");
|
7 | import shimUtilPromisify = require("./shim");
|
8 |
|
9 |
|
10 | declare function promisify<TCustom extends Function>(fn: util.CustomPromisify<TCustom>): TCustom;
|
11 |
|
12 | declare function promisify<TResult>(
|
13 | fn: (callback: (err: any, result: TResult) => void) => void,
|
14 | ): () => Promise<TResult>;
|
15 | declare function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
16 |
|
17 | declare function promisify<T1, TResult>(
|
18 | fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void,
|
19 | ): (arg1: T1) => Promise<TResult>;
|
20 | declare function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
21 |
|
22 | declare function promisify<T1, T2, TResult>(
|
23 | fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void,
|
24 | ): (arg1: T1, arg2: T2) => Promise<TResult>;
|
25 | declare function promisify<T1, T2>(
|
26 | fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void,
|
27 | ): (arg1: T1, arg2: T2) => Promise<void>;
|
28 |
|
29 | declare function promisify<T1, T2, T3, TResult>(
|
30 | fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void,
|
31 | ): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
32 | declare function promisify<T1, T2, T3>(
|
33 | fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void,
|
34 | ): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
35 |
|
36 | declare function promisify<T1, T2, T3, T4, TResult>(
|
37 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
38 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
39 | declare function promisify<T1, T2, T3, T4>(
|
40 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void,
|
41 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
42 |
|
43 | declare function promisify<T1, T2, T3, T4, T5, TResult>(
|
44 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
45 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
46 | declare function promisify<T1, T2, T3, T4, T5>(
|
47 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
48 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
49 |
|
50 |
|
51 | declare function promisify(fn: Function): Function;
|
52 |
|
53 | declare namespace promisify {
|
54 | const custom: typeof polyfill.custom;
|
55 |
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | const customPromisifyArgs: typeof polyfill.customPromisifyArgs | undefined;
|
63 |
|
64 | function getPolyfill(): ReturnType<typeof getUtilPromisify>;
|
65 | const implementation: typeof polyfill;
|
66 | function shim(): ReturnType<typeof shimUtilPromisify>;
|
67 | }
|
68 |
|
69 | export = promisify;
|