File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change
1
+ type Awaited < T > = T extends PromiseLike < infer U > ? U : T ;
2
+
1
3
interface PromiseConstructor {
2
4
/**
3
5
* A reference to the prototype.
@@ -12,6 +14,13 @@ interface PromiseConstructor {
12
14
*/
13
15
new < T > ( executor : ( resolve : ( value ?: T | PromiseLike < T > ) => void , reject : ( reason ?: any ) => void ) => void ) : Promise < T > ;
14
16
17
+ /**
18
+ * Creates a Promise that is resolved with an array of results when all of the provided Promises
19
+ * resolve, or rejected when any Promise is rejected.
20
+ * @param values An array of Promises.
21
+ * @returns A new Promise.
22
+ */
23
+ all < T extends unknown [ ] > ( values : readonly [ ...T ] ) : Promise < { [ P in keyof T ] : Awaited < T [ P ] > } > ;
15
24
/**
16
25
* Creates a Promise that is resolved with an array of results when all of the provided Promises
17
26
* resolve, or rejected when any Promise is rejected.
You can’t perform that action at this time.
0 commit comments