1// Type definitions for lie 3.2
2// Project: https://github.com/calvinmetcalf/lie#readme
3// Definitions by: Andre Wiggins <https://github.com/andrewiggins>
4// TypeScript Version: 2.3
6// These types are copied from TypeScript's built-in Promise types
7// and extended with extra Lie utilities namely, finally.
9export as namespace Promise;
12 * Represents the completion of an asynchronous operation
16 * Attaches callbacks for the resolution and/or rejection of the Promise.
17 * @param onfulfilled The callback to execute when the Promise is resolved.
18 * @param onrejected The callback to execute when the Promise is rejected.
19 * @returns A Promise for the completion of which ever callback is executed.
21 then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
24 * Attaches a callback for only the rejection of the Promise.
25 * @param onrejected The callback to execute when the Promise is rejected.
26 * @returns A Promise for the completion of the callback.
28 catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
31 * When the promise is settled, whether fulfilled or rejected, execute the
32 * specified callback function. This provides a way for code that must be
33 * executed once the Promise has been dealt with to be run whether the promise
34 * was fulfilled successfully or rejected.
35 * @param onfinally Function called when the Promise is settled
36 * @returns A Promise whose finally handler is set to the specified function, onfinally.
38 finally<TResult = never>(onfinally?: (() => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
41interface PromiseConstructor {
43 * A reference to the prototype.
45 readonly prototype: Promise<any>;
48 * Creates a new Promise.
49 * @param executor A callback used to initialize the promise. This callback is passed two arguments:
50 * a resolve callback used resolve the promise with a value or the result of another promise,
51 * and a reject callback used to reject the promise with a provided reason or error.
53 new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
56 * Creates a Promise that is resolved with an array of results when all of the provided Promises
57 * resolve, or rejected when any Promise is rejected.
58 * @param values An array of Promises.
59 * @returns A new Promise.
61 all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
64 * Creates a Promise that is resolved with an array of results when all of the provided Promises
65 * resolve, or rejected when any Promise is rejected.
66 * @param values An array of Promises.
67 * @returns A new Promise.
69 all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
72 * Creates a Promise that is resolved with an array of results when all of the provided Promises
73 * resolve, or rejected when any Promise is rejected.
74 * @param values An array of Promises.
75 * @returns A new Promise.
77 all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
80 * Creates a Promise that is resolved with an array of results when all of the provided Promises
81 * resolve, or rejected when any Promise is rejected.
82 * @param values An array of Promises.
83 * @returns A new Promise.
85 all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
88 * Creates a Promise that is resolved with an array of results when all of the provided Promises
89 * resolve, or rejected when any Promise is rejected.
90 * @param values An array of Promises.
91 * @returns A new Promise.
93 all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
96 * Creates a Promise that is resolved with an array of results when all of the provided Promises
97 * resolve, or rejected when any Promise is rejected.
98 * @param values An array of Promises.
99 * @returns A new Promise.
101 all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
104 * Creates a Promise that is resolved with an array of results when all of the provided Promises
105 * resolve, or rejected when any Promise is rejected.
106 * @param values An array of Promises.
107 * @returns A new Promise.
109 all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>;
112 * Creates a Promise that is resolved with an array of results when all of the provided Promises
113 * resolve, or rejected when any Promise is rejected.
114 * @param values An array of Promises.
115 * @returns A new Promise.
117 all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
120 * Creates a Promise that is resolved with an array of results when all of the provided Promises
121 * resolve, or rejected when any Promise is rejected.
122 * @param values An array of Promises.
123 * @returns A new Promise.
125 all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
128 * Creates a Promise that is resolved with an array of results when all of the provided Promises
129 * resolve, or rejected when any Promise is rejected.
130 * @param values An array of Promises.
131 * @returns A new Promise.
133 all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
136 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
138 * @param values An array of Promises.
139 * @returns A new Promise.
141 race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
144 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
146 * @param values An array of Promises.
147 * @returns A new Promise.
149 race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
152 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
154 * @param values An array of Promises.
155 * @returns A new Promise.
157 race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
160 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
162 * @param values An array of Promises.
163 * @returns A new Promise.
165 race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
168 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
170 * @param values An array of Promises.
171 * @returns A new Promise.
173 race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;
176 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
178 * @param values An array of Promises.
179 * @returns A new Promise.
181 race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;
184 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
186 * @param values An array of Promises.
187 * @returns A new Promise.
189 race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;
192 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
194 * @param values An array of Promises.
195 * @returns A new Promise.
197 race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;
200 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
202 * @param values An array of Promises.
203 * @returns A new Promise.
205 race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;
208 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
210 * @param values An array of Promises.
211 * @returns A new Promise.
213 race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;
216 * Creates a new rejected promise for the provided reason.
217 * @param reason The reason the promise was rejected.
218 * @returns A new rejected Promise.
220 reject(reason: any): Promise<never>;
223 * Creates a new rejected promise for the provided reason.
224 * @param reason The reason the promise was rejected.
225 * @returns A new rejected Promise.
227 reject<T>(reason: any): Promise<T>;
230 * Creates a new resolved promise for the provided value.
231 * @param value A promise.
232 * @returns A promise whose internal state matches the provided promise.
234 resolve<T>(value: T | PromiseLike<T>): Promise<T>;
237 * Creates a new resolved promise .
238 * @returns A resolved promise.
240 resolve(): Promise<void>;
243declare const Promise: PromiseConstructor;
244export default Promise;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list