Skip to content

Commit 1c4083f

Browse files
authored
Add ESNext float16 features and fix TypedArrays of BigInt types (#60151)
1 parent b78f466 commit 1c4083f

File tree

109 files changed

+1844
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1844
-1141
lines changed

src/compiler/commandLineParser.ts

+1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ const libEntries: [string, string][] = [
248248
["esnext.string", "lib.es2024.string.d.ts"],
249249
["esnext.iterator", "lib.esnext.iterator.d.ts"],
250250
["esnext.promise", "lib.esnext.promise.d.ts"],
251+
["esnext.float16", "lib.esnext.float16.d.ts"],
251252
["decorators", "lib.decorators.d.ts"],
252253
["decorators.legacy", "lib.decorators.legacy.d.ts"],
253254
];

src/compiler/utilities.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,9 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
15621562
"fround",
15631563
"cbrt",
15641564
],
1565+
esnext: [
1566+
"f16round",
1567+
],
15651568
})),
15661569
Map: new Map(Object.entries({
15671570
es2015: [
@@ -1731,6 +1734,10 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
17311734
"getBigInt64",
17321735
"getBigUint64",
17331736
],
1737+
esnext: [
1738+
"setFloat16",
1739+
"getFloat16",
1740+
],
17341741
})),
17351742
BigInt: new Map(Object.entries({
17361743
es2020: emptyArray,
@@ -1833,6 +1840,9 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
18331840
"with",
18341841
],
18351842
})),
1843+
Float16Array: new Map(Object.entries({
1844+
esnext: emptyArray,
1845+
})),
18361846
Float32Array: new Map(Object.entries({
18371847
es2022: [
18381848
"at",

src/lib/es2015.iterable.d.ts

+69-54
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ interface SetIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknow
178178
interface Set<T> {
179179
/** Iterates over values in the set. */
180180
[Symbol.iterator](): SetIterator<T>;
181+
181182
/**
182183
* Returns an iterable of [v,v] pairs for every value `v` in the set.
183184
*/
184185
entries(): SetIterator<[T, T]>;
186+
185187
/**
186188
* Despite its name, returns an iterable of the values in the set.
187189
*/
@@ -254,14 +256,17 @@ interface String {
254256

255257
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
256258
[Symbol.iterator](): ArrayIterator<number>;
259+
257260
/**
258261
* Returns an array of key, value pairs for every entry in the array
259262
*/
260263
entries(): ArrayIterator<[number, number]>;
264+
261265
/**
262266
* Returns an list of keys in the array
263267
*/
264268
keys(): ArrayIterator<number>;
269+
265270
/**
266271
* Returns an list of values in the array
267272
*/
@@ -273,30 +278,32 @@ interface Int8ArrayConstructor {
273278

274279
/**
275280
* Creates an array from an array-like or iterable object.
276-
* @param arrayLike An array-like or iterable object to convert to an array.
277-
* @param mapfn A mapping function to call on every element of the array.
278-
* @param thisArg Value of 'this' used to invoke the mapfn.
281+
* @param elements An iterable object to convert to an array.
279282
*/
280-
from(arrayLike: Iterable<number>): Int8Array<ArrayBuffer>;
283+
from(elements: Iterable<number>): Int8Array<ArrayBuffer>;
284+
281285
/**
282286
* Creates an array from an array-like or iterable object.
283-
* @param arrayLike An array-like or iterable object to convert to an array.
287+
* @param elements An iterable object to convert to an array.
284288
* @param mapfn A mapping function to call on every element of the array.
285289
* @param thisArg Value of 'this' used to invoke the mapfn.
286290
*/
287-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int8Array<ArrayBuffer>;
291+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int8Array<ArrayBuffer>;
288292
}
289293

290294
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
291295
[Symbol.iterator](): ArrayIterator<number>;
296+
292297
/**
293298
* Returns an array of key, value pairs for every entry in the array
294299
*/
295300
entries(): ArrayIterator<[number, number]>;
301+
296302
/**
297303
* Returns an list of keys in the array
298304
*/
299305
keys(): ArrayIterator<number>;
306+
300307
/**
301308
* Returns an list of values in the array
302309
*/
@@ -308,22 +315,22 @@ interface Uint8ArrayConstructor {
308315

309316
/**
310317
* Creates an array from an array-like or iterable object.
311-
* @param arrayLike An array-like or iterable object to convert to an array.
312-
* @param mapfn A mapping function to call on every element of the array.
313-
* @param thisArg Value of 'this' used to invoke the mapfn.
318+
* @param elements An iterable object to convert to an array.
314319
*/
315-
from(arrayLike: Iterable<number>): Uint8Array<ArrayBuffer>;
320+
from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;
321+
316322
/**
317323
* Creates an array from an array-like or iterable object.
318-
* @param arrayLike An array-like or iterable object to convert to an array.
324+
* @param elements An iterable object to convert to an array.
319325
* @param mapfn A mapping function to call on every element of the array.
320326
* @param thisArg Value of 'this' used to invoke the mapfn.
321327
*/
322-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
328+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
323329
}
324330

325331
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
326332
[Symbol.iterator](): ArrayIterator<number>;
333+
327334
/**
328335
* Returns an array of key, value pairs for every entry in the array
329336
*/
@@ -345,18 +352,17 @@ interface Uint8ClampedArrayConstructor {
345352

346353
/**
347354
* Creates an array from an array-like or iterable object.
348-
* @param arrayLike An array-like or iterable object to convert to an array.
349-
* @param mapfn A mapping function to call on every element of the array.
350-
* @param thisArg Value of 'this' used to invoke the mapfn.
355+
* @param elements An iterable object to convert to an array.
351356
*/
352-
from(arrayLike: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;
357+
from(elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;
358+
353359
/**
354360
* Creates an array from an array-like or iterable object.
355-
* @param arrayLike An array-like or iterable object to convert to an array.
361+
* @param elements An iterable object to convert to an array.
356362
* @param mapfn A mapping function to call on every element of the array.
357363
* @param thisArg Value of 'this' used to invoke the mapfn.
358364
*/
359-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray<ArrayBuffer>;
365+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray<ArrayBuffer>;
360366
}
361367

362368
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
@@ -382,30 +388,32 @@ interface Int16ArrayConstructor {
382388

383389
/**
384390
* Creates an array from an array-like or iterable object.
385-
* @param arrayLike An array-like or iterable object to convert to an array.
386-
* @param mapfn A mapping function to call on every element of the array.
387-
* @param thisArg Value of 'this' used to invoke the mapfn.
391+
* @param elements An iterable object to convert to an array.
388392
*/
389-
from(arrayLike: Iterable<number>): Int16Array<ArrayBuffer>;
393+
from(elements: Iterable<number>): Int16Array<ArrayBuffer>;
394+
390395
/**
391396
* Creates an array from an array-like or iterable object.
392-
* @param arrayLike An array-like or iterable object to convert to an array.
397+
* @param elements An iterable object to convert to an array.
393398
* @param mapfn A mapping function to call on every element of the array.
394399
* @param thisArg Value of 'this' used to invoke the mapfn.
395400
*/
396-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int16Array<ArrayBuffer>;
401+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int16Array<ArrayBuffer>;
397402
}
398403

399404
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
400405
[Symbol.iterator](): ArrayIterator<number>;
406+
401407
/**
402408
* Returns an array of key, value pairs for every entry in the array
403409
*/
404410
entries(): ArrayIterator<[number, number]>;
411+
405412
/**
406413
* Returns an list of keys in the array
407414
*/
408415
keys(): ArrayIterator<number>;
416+
409417
/**
410418
* Returns an list of values in the array
411419
*/
@@ -417,30 +425,32 @@ interface Uint16ArrayConstructor {
417425

418426
/**
419427
* Creates an array from an array-like or iterable object.
420-
* @param arrayLike An array-like or iterable object to convert to an array.
421-
* @param mapfn A mapping function to call on every element of the array.
422-
* @param thisArg Value of 'this' used to invoke the mapfn.
428+
* @param elements An iterable object to convert to an array.
423429
*/
424-
from(arrayLike: Iterable<number>): Uint16Array<ArrayBuffer>;
430+
from(elements: Iterable<number>): Uint16Array<ArrayBuffer>;
431+
425432
/**
426433
* Creates an array from an array-like or iterable object.
427-
* @param arrayLike An array-like or iterable object to convert to an array.
434+
* @param elements An iterable object to convert to an array.
428435
* @param mapfn A mapping function to call on every element of the array.
429436
* @param thisArg Value of 'this' used to invoke the mapfn.
430437
*/
431-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint16Array<ArrayBuffer>;
438+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint16Array<ArrayBuffer>;
432439
}
433440

434441
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
435442
[Symbol.iterator](): ArrayIterator<number>;
443+
436444
/**
437445
* Returns an array of key, value pairs for every entry in the array
438446
*/
439447
entries(): ArrayIterator<[number, number]>;
448+
440449
/**
441450
* Returns an list of keys in the array
442451
*/
443452
keys(): ArrayIterator<number>;
453+
444454
/**
445455
* Returns an list of values in the array
446456
*/
@@ -452,30 +462,32 @@ interface Int32ArrayConstructor {
452462

453463
/**
454464
* Creates an array from an array-like or iterable object.
455-
* @param arrayLike An array-like or iterable object to convert to an array.
456-
* @param mapfn A mapping function to call on every element of the array.
457-
* @param thisArg Value of 'this' used to invoke the mapfn.
465+
* @param elements An iterable object to convert to an array.
458466
*/
459-
from(arrayLike: Iterable<number>): Int32Array<ArrayBuffer>;
467+
from(elements: Iterable<number>): Int32Array<ArrayBuffer>;
468+
460469
/**
461470
* Creates an array from an array-like or iterable object.
462-
* @param arrayLike An array-like or iterable object to convert to an array.
471+
* @param elements An iterable object to convert to an array.
463472
* @param mapfn A mapping function to call on every element of the array.
464473
* @param thisArg Value of 'this' used to invoke the mapfn.
465474
*/
466-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int32Array<ArrayBuffer>;
475+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int32Array<ArrayBuffer>;
467476
}
468477

469478
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
470479
[Symbol.iterator](): ArrayIterator<number>;
480+
471481
/**
472482
* Returns an array of key, value pairs for every entry in the array
473483
*/
474484
entries(): ArrayIterator<[number, number]>;
485+
475486
/**
476487
* Returns an list of keys in the array
477488
*/
478489
keys(): ArrayIterator<number>;
490+
479491
/**
480492
* Returns an list of values in the array
481493
*/
@@ -487,30 +499,32 @@ interface Uint32ArrayConstructor {
487499

488500
/**
489501
* Creates an array from an array-like or iterable object.
490-
* @param arrayLike An array-like or iterable object to convert to an array.
491-
* @param mapfn A mapping function to call on every element of the array.
492-
* @param thisArg Value of 'this' used to invoke the mapfn.
502+
* @param elements An iterable object to convert to an array.
493503
*/
494-
from(arrayLike: Iterable<number>): Uint32Array<ArrayBuffer>;
504+
from(elements: Iterable<number>): Uint32Array<ArrayBuffer>;
505+
495506
/**
496507
* Creates an array from an array-like or iterable object.
497-
* @param arrayLike An array-like or iterable object to convert to an array.
508+
* @param elements An iterable object to convert to an array.
498509
* @param mapfn A mapping function to call on every element of the array.
499510
* @param thisArg Value of 'this' used to invoke the mapfn.
500511
*/
501-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint32Array<ArrayBuffer>;
512+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint32Array<ArrayBuffer>;
502513
}
503514

504515
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
505516
[Symbol.iterator](): ArrayIterator<number>;
517+
506518
/**
507519
* Returns an array of key, value pairs for every entry in the array
508520
*/
509521
entries(): ArrayIterator<[number, number]>;
522+
510523
/**
511524
* Returns an list of keys in the array
512525
*/
513526
keys(): ArrayIterator<number>;
527+
514528
/**
515529
* Returns an list of values in the array
516530
*/
@@ -522,30 +536,32 @@ interface Float32ArrayConstructor {
522536

523537
/**
524538
* Creates an array from an array-like or iterable object.
525-
* @param arrayLike An array-like or iterable object to convert to an array.
526-
* @param mapfn A mapping function to call on every element of the array.
527-
* @param thisArg Value of 'this' used to invoke the mapfn.
539+
* @param elements An iterable object to convert to an array.
528540
*/
529-
from(arrayLike: Iterable<number>): Float32Array<ArrayBuffer>;
541+
from(elements: Iterable<number>): Float32Array<ArrayBuffer>;
542+
530543
/**
531544
* Creates an array from an array-like or iterable object.
532-
* @param arrayLike An array-like or iterable object to convert to an array.
545+
* @param elements An iterable object to convert to an array.
533546
* @param mapfn A mapping function to call on every element of the array.
534547
* @param thisArg Value of 'this' used to invoke the mapfn.
535548
*/
536-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float32Array<ArrayBuffer>;
549+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float32Array<ArrayBuffer>;
537550
}
538551

539552
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
540553
[Symbol.iterator](): ArrayIterator<number>;
554+
541555
/**
542556
* Returns an array of key, value pairs for every entry in the array
543557
*/
544558
entries(): ArrayIterator<[number, number]>;
559+
545560
/**
546561
* Returns an list of keys in the array
547562
*/
548563
keys(): ArrayIterator<number>;
564+
549565
/**
550566
* Returns an list of values in the array
551567
*/
@@ -557,16 +573,15 @@ interface Float64ArrayConstructor {
557573

558574
/**
559575
* Creates an array from an array-like or iterable object.
560-
* @param arrayLike An array-like or iterable object to convert to an array.
561-
* @param mapfn A mapping function to call on every element of the array.
562-
* @param thisArg Value of 'this' used to invoke the mapfn.
576+
* @param elements An iterable object to convert to an array.
563577
*/
564-
from(arrayLike: Iterable<number>): Float64Array<ArrayBuffer>;
578+
from(elements: Iterable<number>): Float64Array<ArrayBuffer>;
579+
565580
/**
566581
* Creates an array from an array-like or iterable object.
567-
* @param arrayLike An array-like or iterable object to convert to an array.
582+
* @param elements An iterable object to convert to an array.
568583
* @param mapfn A mapping function to call on every element of the array.
569584
* @param thisArg Value of 'this' used to invoke the mapfn.
570585
*/
571-
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float64Array<ArrayBuffer>;
586+
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float64Array<ArrayBuffer>;
572587
}

0 commit comments

Comments
 (0)