Skip to content

Commit 9a55fac

Browse files
committed
Update LKG
1 parent 0fb2ef3 commit 9a55fac

14 files changed

Lines changed: 26817 additions & 42445 deletions

lib/lib.d.ts

Lines changed: 706 additions & 146 deletions
Large diffs are not rendered by default.

lib/lib.dom.d.ts

Lines changed: 671 additions & 131 deletions
Large diffs are not rendered by default.

lib/lib.es2015.promise.d.ts

Lines changed: 105 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,149 @@ and limitations under the License.
1919
*/
2020
interface Promise<T> {
2121
/**
22-
* Attaches callbacks for the resolution and/or rejection of the Promise.
23-
* @param onfulfilled The callback to execute when the Promise is resolved.
24-
* @param onrejected The callback to execute when the Promise is rejected.
25-
* @returns A Promise for the completion of which ever callback is executed.
26-
*/
27-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
28-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
22+
* Attaches callbacks for the resolution and/or rejection of the Promise.
23+
* @param onfulfilled The callback to execute when the Promise is resolved.
24+
* @param onrejected The callback to execute when the Promise is rejected.
25+
* @returns A Promise for the completion of which ever callback is executed.
26+
*/
27+
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
28+
29+
/**
30+
* Attaches callbacks for the resolution and/or rejection of the Promise.
31+
* @param onfulfilled The callback to execute when the Promise is resolved.
32+
* @param onrejected The callback to execute when the Promise is rejected.
33+
* @returns A Promise for the completion of which ever callback is executed.
34+
*/
35+
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
36+
37+
/**
38+
* Attaches callbacks for the resolution and/or rejection of the Promise.
39+
* @param onfulfilled The callback to execute when the Promise is resolved.
40+
* @returns A Promise for the completion of which ever callback is executed.
41+
*/
42+
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): Promise<TResult>;
43+
44+
/**
45+
* Creates a new Promise with the same internal state of this Promise.
46+
* @returns A Promise.
47+
*/
48+
then(): Promise<T>;
2949

3050
/**
3151
* Attaches a callback for only the rejection of the Promise.
3252
* @param onrejected The callback to execute when the Promise is rejected.
3353
* @returns A Promise for the completion of the callback.
3454
*/
35-
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
36-
catch(onrejected?: (reason: any) => void): Promise<T>;
55+
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
56+
57+
/**
58+
* Attaches a callback for only the rejection of the Promise.
59+
* @param onrejected The callback to execute when the Promise is rejected.
60+
* @returns A Promise for the completion of the callback.
61+
*/
62+
catch(onrejected: (reason: any) => T | PromiseLike<T>): Promise<T>;
3763
}
3864

3965
interface PromiseConstructor {
40-
/**
41-
* A reference to the prototype.
66+
/**
67+
* A reference to the prototype.
4268
*/
4369
readonly prototype: Promise<any>;
4470

4571
/**
4672
* Creates a new Promise.
47-
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
48-
* a resolve callback used resolve the promise with a value or the result of another promise,
73+
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
74+
* a resolve callback used resolve the promise with a value or the result of another promise,
4975
* and a reject callback used to reject the promise with a provided reason or error.
5076
*/
5177
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
5278

5379
/**
54-
* Creates a Promise that is resolved with an array of results when all of the provided Promises
80+
* Creates a Promise that is resolved with an array of results when all of the provided Promises
5581
* resolve, or rejected when any Promise is rejected.
5682
* @param values An array of Promises.
5783
* @returns A new Promise.
5884
*/
5985
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]>;
86+
87+
/**
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.
92+
*/
6093
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]>;
94+
95+
/**
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.
100+
*/
61101
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]>;
102+
103+
/**
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.
108+
*/
62109
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]>;
110+
111+
/**
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.
116+
*/
63117
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]>;
118+
119+
/**
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.
124+
*/
64125
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]>;
126+
127+
/**
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.
132+
*/
65133
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
134+
135+
/**
136+
* Creates a Promise that is resolved with an array of results when all of the provided Promises
137+
* resolve, or rejected when any Promise is rejected.
138+
* @param values An array of Promises.
139+
* @returns A new Promise.
140+
*/
66141
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
142+
143+
/**
144+
* Creates a Promise that is resolved with an array of results when all of the provided Promises
145+
* resolve, or rejected when any Promise is rejected.
146+
* @param values An array of Promises.
147+
* @returns A new Promise.
148+
*/
67149
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
68150

151+
/**
152+
* Creates a Promise that is resolved with an array of results when all of the provided Promises
153+
* resolve, or rejected when any Promise is rejected.
154+
* @param values An array of Promises.
155+
* @returns A new Promise.
156+
*/
157+
all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
158+
69159
/**
70160
* Creates a new rejected promise for the provided reason.
71161
* @param reason The reason the promise was rejected.
72162
* @returns A new rejected Promise.
73163
*/
74-
reject(reason: any): Promise<void>;
164+
reject(reason: any): Promise<never>;
75165

76166
/**
77167
* Creates a new rejected promise for the provided reason.

lib/lib.es5.d.ts

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,13 +1271,33 @@ declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | P
12711271

12721272
interface PromiseLike<T> {
12731273
/**
1274-
* Attaches callbacks for the resolution and/or rejection of the Promise.
1275-
* @param onfulfilled The callback to execute when the Promise is resolved.
1276-
* @param onrejected The callback to execute when the Promise is rejected.
1277-
* @returns A Promise for the completion of which ever callback is executed.
1278-
*/
1279-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
1280-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
1274+
* Attaches callbacks for the resolution and/or rejection of the Promise.
1275+
* @param onfulfilled The callback to execute when the Promise is resolved.
1276+
* @param onrejected The callback to execute when the Promise is rejected.
1277+
* @returns A Promise for the completion of which ever callback is executed.
1278+
*/
1279+
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
1280+
1281+
/**
1282+
* Attaches callbacks for the resolution and/or rejection of the Promise.
1283+
* @param onfulfilled The callback to execute when the Promise is resolved.
1284+
* @param onrejected The callback to execute when the Promise is rejected.
1285+
* @returns A Promise for the completion of which ever callback is executed.
1286+
*/
1287+
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
1288+
1289+
/**
1290+
* Attaches callbacks for the resolution and/or rejection of the Promise.
1291+
* @param onfulfilled The callback to execute when the Promise is resolved.
1292+
* @returns A Promise for the completion of which ever callback is executed.
1293+
*/
1294+
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
1295+
1296+
/**
1297+
* Creates a new Promise with the same internal state of this Promise.
1298+
* @returns A Promise.
1299+
*/
1300+
then(): PromiseLike<T>;
12811301
}
12821302

12831303
interface ArrayLike<T> {
@@ -1540,7 +1560,7 @@ interface Int8Array {
15401560
* Returns the index of the first element in the array where predicate is true, and undefined
15411561
* otherwise.
15421562
* @param predicate find calls predicate once for each element of the array, in ascending
1543-
* order, until it finds one where predicate returns true. If such an element is found,
1563+
* order, until it finds one where predicate returns true. If such an element is found,
15441564
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
15451565
* @param thisArg If provided, it will be used as the this value for each invocation of
15461566
* predicate. If it is not provided, undefined is used instead.
@@ -1813,7 +1833,7 @@ interface Uint8Array {
18131833
* Returns the index of the first element in the array where predicate is true, and undefined
18141834
* otherwise.
18151835
* @param predicate find calls predicate once for each element of the array, in ascending
1816-
* order, until it finds one where predicate returns true. If such an element is found,
1836+
* order, until it finds one where predicate returns true. If such an element is found,
18171837
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
18181838
* @param thisArg If provided, it will be used as the this value for each invocation of
18191839
* predicate. If it is not provided, undefined is used instead.
@@ -2087,7 +2107,7 @@ interface Uint8ClampedArray {
20872107
* Returns the index of the first element in the array where predicate is true, and undefined
20882108
* otherwise.
20892109
* @param predicate find calls predicate once for each element of the array, in ascending
2090-
* order, until it finds one where predicate returns true. If such an element is found,
2110+
* order, until it finds one where predicate returns true. If such an element is found,
20912111
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
20922112
* @param thisArg If provided, it will be used as the this value for each invocation of
20932113
* predicate. If it is not provided, undefined is used instead.
@@ -2360,7 +2380,7 @@ interface Int16Array {
23602380
* Returns the index of the first element in the array where predicate is true, and undefined
23612381
* otherwise.
23622382
* @param predicate find calls predicate once for each element of the array, in ascending
2363-
* order, until it finds one where predicate returns true. If such an element is found,
2383+
* order, until it finds one where predicate returns true. If such an element is found,
23642384
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
23652385
* @param thisArg If provided, it will be used as the this value for each invocation of
23662386
* predicate. If it is not provided, undefined is used instead.
@@ -2634,7 +2654,7 @@ interface Uint16Array {
26342654
* Returns the index of the first element in the array where predicate is true, and undefined
26352655
* otherwise.
26362656
* @param predicate find calls predicate once for each element of the array, in ascending
2637-
* order, until it finds one where predicate returns true. If such an element is found,
2657+
* order, until it finds one where predicate returns true. If such an element is found,
26382658
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
26392659
* @param thisArg If provided, it will be used as the this value for each invocation of
26402660
* predicate. If it is not provided, undefined is used instead.
@@ -2907,7 +2927,7 @@ interface Int32Array {
29072927
* Returns the index of the first element in the array where predicate is true, and undefined
29082928
* otherwise.
29092929
* @param predicate find calls predicate once for each element of the array, in ascending
2910-
* order, until it finds one where predicate returns true. If such an element is found,
2930+
* order, until it finds one where predicate returns true. If such an element is found,
29112931
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
29122932
* @param thisArg If provided, it will be used as the this value for each invocation of
29132933
* predicate. If it is not provided, undefined is used instead.
@@ -3180,7 +3200,7 @@ interface Uint32Array {
31803200
* Returns the index of the first element in the array where predicate is true, and undefined
31813201
* otherwise.
31823202
* @param predicate find calls predicate once for each element of the array, in ascending
3183-
* order, until it finds one where predicate returns true. If such an element is found,
3203+
* order, until it finds one where predicate returns true. If such an element is found,
31843204
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
31853205
* @param thisArg If provided, it will be used as the this value for each invocation of
31863206
* predicate. If it is not provided, undefined is used instead.
@@ -3453,7 +3473,7 @@ interface Float32Array {
34533473
* Returns the index of the first element in the array where predicate is true, and undefined
34543474
* otherwise.
34553475
* @param predicate find calls predicate once for each element of the array, in ascending
3456-
* order, until it finds one where predicate returns true. If such an element is found,
3476+
* order, until it finds one where predicate returns true. If such an element is found,
34573477
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
34583478
* @param thisArg If provided, it will be used as the this value for each invocation of
34593479
* predicate. If it is not provided, undefined is used instead.
@@ -3727,7 +3747,7 @@ interface Float64Array {
37273747
* Returns the index of the first element in the array where predicate is true, and undefined
37283748
* otherwise.
37293749
* @param predicate find calls predicate once for each element of the array, in ascending
3730-
* order, until it finds one where predicate returns true. If such an element is found,
3750+
* order, until it finds one where predicate returns true. If such an element is found,
37313751
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
37323752
* @param thisArg If provided, it will be used as the this value for each invocation of
37333753
* predicate. If it is not provided, undefined is used instead.

0 commit comments

Comments
 (0)