Skip to content

Commit 75a3580

Browse files
Update LKG
1 parent 859f4c1 commit 75a3580

15 files changed

+37693
-38365
lines changed

lib/lib.es2015.iterable.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,23 @@ interface PromiseConstructor {
223223
* @param values An iterable of Promises.
224224
* @returns A new Promise.
225225
*/
226-
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<(awaited T)[]>;
226+
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
227227

228228
/**
229229
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
230230
* or rejected.
231231
* @param values An iterable of Promises.
232232
* @returns A new Promise.
233233
*/
234-
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<awaited T>;
234+
race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
235+
236+
/**
237+
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
238+
* or rejected.
239+
* @param values An iterable of Promises.
240+
* @returns A new Promise.
241+
*/
242+
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
235243
}
236244

237245
declare namespace Reflect {

lib/lib.es2015.promise.d.ts

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,123 +30,115 @@ interface PromiseConstructor {
3030
* a resolve callback used to resolve the promise with a value or the result of another promise,
3131
* and a reject callback used to reject the promise with a provided reason or error.
3232
*/
33-
new <T>(executor: (resolve: (value?: T | PromiseLike<T> | awaited T) => void, reject: (reason?: any) => void) => void): Promise<T>;
33+
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
3434

3535
/**
3636
* Creates a Promise that is resolved with an array of results when all of the provided Promises
3737
* resolve, or rejected when any Promise is rejected.
3838
* @param values An array of Promises.
3939
* @returns A new Promise.
4040
*/
41-
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [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<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8, awaited T9, awaited T10]>;
41+
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [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]>;
4242

4343
/**
4444
* Creates a Promise that is resolved with an array of results when all of the provided Promises
4545
* resolve, or rejected when any Promise is rejected.
4646
* @param values An array of Promises.
4747
* @returns A new Promise.
4848
*/
49-
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [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<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8, awaited T9]>;
50-
51-
/**
52-
* Creates a Promise that is resolved with an array of results when all of the provided Promises
53-
* resolve, or rejected when any Promise is rejected.
54-
* @param values An array of Promises.
55-
* @returns A new Promise.
56-
*/
57-
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [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<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8]>;
58-
49+
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [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]>;
50+
5951
/**
6052
* Creates a Promise that is resolved with an array of results when all of the provided Promises
6153
* resolve, or rejected when any Promise is rejected.
6254
* @param values An array of Promises.
6355
* @returns A new Promise.
6456
*/
65-
all<T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7]>;
66-
57+
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [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]>;
58+
6759
/**
6860
* Creates a Promise that is resolved with an array of results when all of the provided Promises
6961
* resolve, or rejected when any Promise is rejected.
7062
* @param values An array of Promises.
7163
* @returns A new Promise.
7264
*/
73-
all<T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6]>;
74-
65+
all<T1, T2, T3, T4, T5, T6, T7>(values: readonly [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]>;
66+
7567
/**
7668
* Creates a Promise that is resolved with an array of results when all of the provided Promises
7769
* resolve, or rejected when any Promise is rejected.
7870
* @param values An array of Promises.
7971
* @returns A new Promise.
8072
*/
81-
all<T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5]>;
82-
73+
all<T1, T2, T3, T4, T5, T6>(values: readonly [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]>;
74+
8375
/**
8476
* Creates a Promise that is resolved with an array of results when all of the provided Promises
8577
* resolve, or rejected when any Promise is rejected.
8678
* @param values An array of Promises.
8779
* @returns A new Promise.
8880
*/
89-
all<T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4]>;
90-
81+
all<T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
82+
9183
/**
9284
* Creates a Promise that is resolved with an array of results when all of the provided Promises
9385
* resolve, or rejected when any Promise is rejected.
9486
* @param values An array of Promises.
9587
* @returns A new Promise.
9688
*/
97-
all<T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[awaited T1, awaited T2, awaited T3]>;
98-
89+
all<T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>;
90+
9991
/**
10092
* Creates a Promise that is resolved with an array of results when all of the provided Promises
10193
* resolve, or rejected when any Promise is rejected.
10294
* @param values An array of Promises.
10395
* @returns A new Promise.
10496
*/
105-
all<T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[awaited T1, awaited T2]>;
97+
all<T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
10698

10799
/**
108100
* Creates a Promise that is resolved with an array of results when all of the provided Promises
109101
* resolve, or rejected when any Promise is rejected.
110102
* @param values An array of Promises.
111103
* @returns A new Promise.
112104
*/
113-
all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: awaited T[P] }>;
105+
all<T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
114106

115107
/**
116108
* Creates a Promise that is resolved with an array of results when all of the provided Promises
117109
* resolve, or rejected when any Promise is rejected.
118110
* @param values An array of Promises.
119111
* @returns A new Promise.
120112
*/
121-
all<T>(values: readonly (T | PromiseLike<T>)[]): Promise<(awaited T)[]>;
113+
all<T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>;
122114

123115
// see: lib.es2015.iterable.d.ts
124-
// all<T>(values: Iterable<T | PromiseLike<T>>): Promise<(awaited T)[]>;
116+
// all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
125117

126118
/**
127119
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
128120
* or rejected.
129121
* @param values An array of Promises.
130122
* @returns A new Promise.
131123
*/
132-
race<T>(values: readonly (T | PromiseLike<T>)[]): Promise<awaited T>;
124+
race<T>(values: readonly T[]): Promise<T extends PromiseLike<infer U> ? U : T>;
133125

134126
// see: lib.es2015.iterable.d.ts
135-
// race<T>(values: Iterable<T | PromiseLike<T>>): Promise<awaited T>;
127+
// race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
136128

137129
/**
138130
* Creates a new rejected promise for the provided reason.
139131
* @param reason The reason the promise was rejected.
140132
* @returns A new rejected Promise.
141133
*/
142-
reject<T = never>(reason?: any): Promise<awaited T>;
134+
reject<T = never>(reason?: any): Promise<T>;
143135

144136
/**
145137
* Creates a new resolved promise for the provided value.
146138
* @param value A promise.
147139
* @returns A promise whose internal state matches the provided promise.
148140
*/
149-
resolve<T>(value: T | PromiseLike<T>): Promise<awaited T>;
141+
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
150142

151143
/**
152144
* Creates a new resolved promise .

lib/lib.es2018.promise.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ interface Promise<T> {
2828
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
2929
* @returns A Promise for the completion of the callback.
3030
*/
31-
finally(onfinally?: (() => void | PromiseLike<void>) | undefined | null): Promise<awaited T>
31+
finally(onfinally?: (() => void) | undefined | null): Promise<T>
3232
}

lib/lib.es2020.promise.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ interface PromiseConstructor {
3737
* @param values An array of Promises.
3838
* @returns A new Promise.
3939
*/
40-
allSettled<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<awaited T[P]> }>;
40+
allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T):
41+
Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;
4142

4243
/**
4344
* Creates a Promise that is resolved with an array of results when all
4445
* of the provided Promises resolve or reject.
4546
* @param values An array of Promises.
4647
* @returns A new Promise.
4748
*/
48-
allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<awaited T>[]>;
49+
allSettled<T>(values: Iterable<T>): Promise<PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]>;
4950
}

lib/lib.es5.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ declare type PropertyDecorator = (target: Object, propertyKey: string | symbol)
13981398
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
13991399
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
14001400

1401-
declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T> | awaited T) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;
1401+
declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;
14021402

14031403
interface PromiseLike<T> {
14041404
/**
@@ -1407,7 +1407,7 @@ interface PromiseLike<T> {
14071407
* @param onrejected The callback to execute when the Promise is rejected.
14081408
* @returns A Promise for the completion of which ever callback is executed.
14091409
*/
1410-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<awaited TResult1 | awaited TResult2>;
1410+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
14111411
}
14121412

14131413
/**
@@ -1420,14 +1420,14 @@ interface Promise<T> {
14201420
* @param onrejected The callback to execute when the Promise is rejected.
14211421
* @returns A Promise for the completion of which ever callback is executed.
14221422
*/
1423-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<awaited TResult1 | awaited TResult2>;
1423+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
14241424

14251425
/**
14261426
* Attaches a callback for only the rejection of the Promise.
14271427
* @param onrejected The callback to execute when the Promise is rejected.
14281428
* @returns A Promise for the completion of the callback.
14291429
*/
1430-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<awaited T | awaited TResult>;
1430+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
14311431
}
14321432

14331433
interface ArrayLike<T> {

lib/lib.esnext.promise.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ interface PromiseConstructor {
3939
* @param values An array or iterable of Promises.
4040
* @returns A new Promise.
4141
*/
42-
any<T>(values: (T | PromiseLike<T>)[] | Iterable<T | PromiseLike<T>>): Promise<awaited T>
42+
any<T>(values: (T | PromiseLike<T>)[] | Iterable<T | PromiseLike<T>>): Promise<T>
4343
}

0 commit comments

Comments
 (0)