Skip to content

Commit a655592

Browse files
author
Andy
authored
Update LKG (microsoft#18774)
1 parent 5c239fa commit a655592

23 files changed

+15252
-11772
lines changed

lib/lib.d.ts

+235-163
Large diffs are not rendered by default.

lib/lib.dom.d.ts

+171-110
Large diffs are not rendered by default.

lib/lib.es2015.core.d.ts

+7-24
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ interface Array<T> {
3030
* @param thisArg If provided, it will be used as the this value for each invocation of
3131
* predicate. If it is not provided, undefined is used instead.
3232
*/
33-
find(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean): T | undefined;
34-
find(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): T | undefined;
35-
find<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): T | undefined;
33+
find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined;
3634

3735
/**
3836
* Returns the index of the first element in the array where predicate is true, and -1
@@ -43,9 +41,7 @@ interface Array<T> {
4341
* @param thisArg If provided, it will be used as the this value for each invocation of
4442
* predicate. If it is not provided, undefined is used instead.
4543
*/
46-
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean): number;
47-
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): number;
48-
findIndex<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): number;
44+
findIndex(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number;
4945

5046
/**
5147
* Returns the this object after filling the section identified by start and end with value
@@ -76,22 +72,13 @@ interface ArrayConstructor {
7672
* @param mapfn A mapping function to call on every element of the array.
7773
* @param thisArg Value of 'this' used to invoke the mapfn.
7874
*/
79-
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (this: void, v: T, k: number) => U): Array<U>;
80-
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array<U>;
81-
from<Z, T, U>(arrayLike: ArrayLike<T>, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array<U>;
82-
83-
84-
/**
85-
* Creates an array from an array-like object.
86-
* @param arrayLike An array-like object to convert to an array.
87-
*/
88-
from<T>(arrayLike: ArrayLike<T>): Array<T>;
75+
from<T, U = T>(arrayLike: ArrayLike<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[];
8976

9077
/**
9178
* Returns a new array from a set of elements.
9279
* @param items A set of elements to include in the new array object.
9380
*/
94-
of<T>(...items: T[]): Array<T>;
81+
of<T>(...items: T[]): T[];
9582
}
9683

9784
interface DateConstructor {
@@ -360,7 +347,7 @@ interface ObjectConstructor {
360347
* @param o Object that contains the property.
361348
* @param p Name of the property.
362349
*/
363-
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
350+
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor | undefined;
364351

365352
/**
366353
* Adds a property to an object, or modifies attributes of an existing property.
@@ -383,9 +370,7 @@ interface ReadonlyArray<T> {
383370
* @param thisArg If provided, it will be used as the this value for each invocation of
384371
* predicate. If it is not provided, undefined is used instead.
385372
*/
386-
find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => boolean): T | undefined;
387-
find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg: undefined): T | undefined;
388-
find<Z>(predicate: (this: Z, value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg: Z): T | undefined;
373+
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
389374

390375
/**
391376
* Returns the index of the first element in the array where predicate is true, and -1
@@ -396,9 +381,7 @@ interface ReadonlyArray<T> {
396381
* @param thisArg If provided, it will be used as the this value for each invocation of
397382
* predicate. If it is not provided, undefined is used instead.
398383
*/
399-
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean): number;
400-
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): number;
401-
findIndex<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): number;
384+
findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): number;
402385
}
403386

404387
interface RegExp {

lib/lib.es2015.iterable.d.ts

+10-90
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,7 @@ interface ArrayConstructor {
7474
* @param mapfn A mapping function to call on every element of the array.
7575
* @param thisArg Value of 'this' used to invoke the mapfn.
7676
*/
77-
from<T, U>(iterable: Iterable<T>, mapfn: (this: void, v: T, k: number) => U): Array<U>;
78-
from<T, U>(iterable: Iterable<T>, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array<U>;
79-
from<Z, T, U>(iterable: Iterable<T>, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array<U>;
80-
81-
/**
82-
* Creates an array from an iterable object.
83-
* @param iterable An iterable object to convert to an array.
84-
*/
85-
from<T>(iterable: Iterable<T>): Array<T>;
77+
from<T, U = T>(iterable: Iterable<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[];
8678
}
8779

8880
interface ReadonlyArray<T> {
@@ -237,10 +229,6 @@ interface String {
237229
[Symbol.iterator](): IterableIterator<string>;
238230
}
239231

240-
/**
241-
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
242-
* number of bytes could not be allocated an exception is raised.
243-
*/
244232
interface Int8Array {
245233
[Symbol.iterator](): IterableIterator<number>;
246234
/**
@@ -266,17 +254,9 @@ interface Int8ArrayConstructor {
266254
* @param mapfn A mapping function to call on every element of the array.
267255
* @param thisArg Value of 'this' used to invoke the mapfn.
268256
*/
269-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int8Array;
270-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array;
271-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array;
272-
273-
from(arrayLike: Iterable<number>): Int8Array;
257+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
274258
}
275259

276-
/**
277-
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
278-
* requested number of bytes could not be allocated an exception is raised.
279-
*/
280260
interface Uint8Array {
281261
[Symbol.iterator](): IterableIterator<number>;
282262
/**
@@ -302,17 +282,9 @@ interface Uint8ArrayConstructor {
302282
* @param mapfn A mapping function to call on every element of the array.
303283
* @param thisArg Value of 'this' used to invoke the mapfn.
304284
*/
305-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint8Array;
306-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array;
307-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array;
308-
309-
from(arrayLike: Iterable<number>): Uint8Array;
285+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
310286
}
311287

312-
/**
313-
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
314-
* If the requested number of bytes could not be allocated an exception is raised.
315-
*/
316288
interface Uint8ClampedArray {
317289
[Symbol.iterator](): IterableIterator<number>;
318290
/**
@@ -341,17 +313,9 @@ interface Uint8ClampedArrayConstructor {
341313
* @param mapfn A mapping function to call on every element of the array.
342314
* @param thisArg Value of 'this' used to invoke the mapfn.
343315
*/
344-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray;
345-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray;
346-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray;
347-
348-
from(arrayLike: Iterable<number>): Uint8ClampedArray;
316+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
349317
}
350318

351-
/**
352-
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
353-
* requested number of bytes could not be allocated an exception is raised.
354-
*/
355319
interface Int16Array {
356320
[Symbol.iterator](): IterableIterator<number>;
357321
/**
@@ -379,17 +343,9 @@ interface Int16ArrayConstructor {
379343
* @param mapfn A mapping function to call on every element of the array.
380344
* @param thisArg Value of 'this' used to invoke the mapfn.
381345
*/
382-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int16Array;
383-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array;
384-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array;
385-
386-
from(arrayLike: Iterable<number>): Int16Array;
346+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
387347
}
388348

389-
/**
390-
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
391-
* requested number of bytes could not be allocated an exception is raised.
392-
*/
393349
interface Uint16Array {
394350
[Symbol.iterator](): IterableIterator<number>;
395351
/**
@@ -415,17 +371,9 @@ interface Uint16ArrayConstructor {
415371
* @param mapfn A mapping function to call on every element of the array.
416372
* @param thisArg Value of 'this' used to invoke the mapfn.
417373
*/
418-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint16Array;
419-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array;
420-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array;
421-
422-
from(arrayLike: Iterable<number>): Uint16Array;
374+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
423375
}
424376

425-
/**
426-
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
427-
* requested number of bytes could not be allocated an exception is raised.
428-
*/
429377
interface Int32Array {
430378
[Symbol.iterator](): IterableIterator<number>;
431379
/**
@@ -451,17 +399,9 @@ interface Int32ArrayConstructor {
451399
* @param mapfn A mapping function to call on every element of the array.
452400
* @param thisArg Value of 'this' used to invoke the mapfn.
453401
*/
454-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int32Array;
455-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array;
456-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array;
457-
458-
from(arrayLike: Iterable<number>): Int32Array;
402+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
459403
}
460404

461-
/**
462-
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
463-
* requested number of bytes could not be allocated an exception is raised.
464-
*/
465405
interface Uint32Array {
466406
[Symbol.iterator](): IterableIterator<number>;
467407
/**
@@ -487,17 +427,9 @@ interface Uint32ArrayConstructor {
487427
* @param mapfn A mapping function to call on every element of the array.
488428
* @param thisArg Value of 'this' used to invoke the mapfn.
489429
*/
490-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint32Array;
491-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array;
492-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array;
493-
494-
from(arrayLike: Iterable<number>): Uint32Array;
430+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
495431
}
496432

497-
/**
498-
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
499-
* of bytes could not be allocated an exception is raised.
500-
*/
501433
interface Float32Array {
502434
[Symbol.iterator](): IterableIterator<number>;
503435
/**
@@ -523,17 +455,9 @@ interface Float32ArrayConstructor {
523455
* @param mapfn A mapping function to call on every element of the array.
524456
* @param thisArg Value of 'this' used to invoke the mapfn.
525457
*/
526-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Float32Array;
527-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array;
528-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array;
529-
530-
from(arrayLike: Iterable<number>): Float32Array;
458+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
531459
}
532460

533-
/**
534-
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
535-
* number of bytes could not be allocated an exception is raised.
536-
*/
537461
interface Float64Array {
538462
[Symbol.iterator](): IterableIterator<number>;
539463
/**
@@ -559,9 +483,5 @@ interface Float64ArrayConstructor {
559483
* @param mapfn A mapping function to call on every element of the array.
560484
* @param thisArg Value of 'this' used to invoke the mapfn.
561485
*/
562-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Float64Array;
563-
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array;
564-
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array;
565-
566-
from(arrayLike: Iterable<number>): Float64Array;
486+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
567487
}

lib/lib.es2015.reflect.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ declare namespace Reflect {
2424
function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
2525
function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
2626
function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
27-
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor;
27+
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
2828
function getPrototypeOf(target: object): object;
2929
function has(target: object, propertyKey: PropertyKey): boolean;
3030
function isExtensible(target: object): boolean;
31-
function ownKeys(target: object): Array<PropertyKey>;
31+
function ownKeys(target: object): PropertyKey[];
3232
function preventExtensions(target: object): boolean;
3333
function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
3434
function setPrototypeOf(target: object, proto: any): boolean;

lib/lib.es2015.symbol.wellknown.d.ts

-42
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,6 @@ interface String {
260260
split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];
261261
}
262262

263-
/**
264-
* Represents a raw buffer of binary data, which is used to store data for the
265-
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
266-
* but can be passed to a typed array or DataView Object to interpret the raw
267-
* buffer as needed.
268-
*/
269263
interface ArrayBuffer {
270264
readonly [Symbol.toStringTag]: "ArrayBuffer";
271265
}
@@ -274,74 +268,38 @@ interface DataView {
274268
readonly [Symbol.toStringTag]: "DataView";
275269
}
276270

277-
/**
278-
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
279-
* number of bytes could not be allocated an exception is raised.
280-
*/
281271
interface Int8Array {
282272
readonly [Symbol.toStringTag]: "Int8Array";
283273
}
284274

285-
/**
286-
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
287-
* requested number of bytes could not be allocated an exception is raised.
288-
*/
289275
interface Uint8Array {
290276
readonly [Symbol.toStringTag]: "UInt8Array";
291277
}
292278

293-
/**
294-
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
295-
* If the requested number of bytes could not be allocated an exception is raised.
296-
*/
297279
interface Uint8ClampedArray {
298280
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
299281
}
300282

301-
/**
302-
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
303-
* requested number of bytes could not be allocated an exception is raised.
304-
*/
305283
interface Int16Array {
306284
readonly [Symbol.toStringTag]: "Int16Array";
307285
}
308286

309-
/**
310-
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
311-
* requested number of bytes could not be allocated an exception is raised.
312-
*/
313287
interface Uint16Array {
314288
readonly [Symbol.toStringTag]: "Uint16Array";
315289
}
316290

317-
/**
318-
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
319-
* requested number of bytes could not be allocated an exception is raised.
320-
*/
321291
interface Int32Array {
322292
readonly [Symbol.toStringTag]: "Int32Array";
323293
}
324294

325-
/**
326-
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
327-
* requested number of bytes could not be allocated an exception is raised.
328-
*/
329295
interface Uint32Array {
330296
readonly [Symbol.toStringTag]: "Uint32Array";
331297
}
332298

333-
/**
334-
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
335-
* of bytes could not be allocated an exception is raised.
336-
*/
337299
interface Float32Array {
338300
readonly [Symbol.toStringTag]: "Float32Array";
339301
}
340302

341-
/**
342-
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
343-
* number of bytes could not be allocated an exception is raised.
344-
*/
345303
interface Float64Array {
346304
readonly [Symbol.toStringTag]: "Float64Array";
347305
}

0 commit comments

Comments
 (0)