@@ -220,258 +220,66 @@ interface String {
220
220
[ Symbol . iterator ] ( ) : IterableIterator < string > ;
221
221
}
222
222
223
- interface Int8Array {
224
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
223
+ interface TypedArray < T extends number | bigint > {
224
+ [ Symbol . iterator ] ( ) : IterableIterator < T > ;
225
225
/**
226
226
* Returns an array of key, value pairs for every entry in the array
227
227
*/
228
- entries ( ) : IterableIterator < [ number , number ] > ;
228
+ entries ( ) : IterableIterator < [ number , T ] > ;
229
229
/**
230
230
* Returns an list of keys in the array
231
231
*/
232
232
keys ( ) : IterableIterator < number > ;
233
233
/**
234
234
* Returns an list of values in the array
235
235
*/
236
- values ( ) : IterableIterator < number > ;
236
+ values ( ) : IterableIterator < T > ;
237
237
}
238
238
239
- interface Int8ArrayConstructor {
240
- new ( elements : Iterable < number > ) : Int8Array ;
239
+ interface TypedArrayConstructor < T extends number | bigint , A extends TypedArray < T > > {
240
+ new ( elements : Iterable < T > ) : A ;
241
241
242
242
/**
243
243
* Creates an array from an array-like or iterable object.
244
244
* @param arrayLike An array-like or iterable object to convert to an array.
245
245
* @param mapfn A mapping function to call on every element of the array.
246
246
* @param thisArg Value of 'this' used to invoke the mapfn.
247
247
*/
248
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Int8Array ;
248
+ from ( arrayLike : Iterable < T > , mapfn ?: ( v : T , k : number ) => T , thisArg ?: any ) : A ;
249
249
}
250
250
251
- interface Uint8Array {
252
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
253
- /**
254
- * Returns an array of key, value pairs for every entry in the array
255
- */
256
- entries ( ) : IterableIterator < [ number , number ] > ;
257
- /**
258
- * Returns an list of keys in the array
259
- */
260
- keys ( ) : IterableIterator < number > ;
261
- /**
262
- * Returns an list of values in the array
263
- */
264
- values ( ) : IterableIterator < number > ;
265
- }
251
+ interface Int8Array extends TypedArray < number > { }
266
252
267
- interface Uint8ArrayConstructor {
268
- new ( elements : Iterable < number > ) : Uint8Array ;
253
+ interface Int8ArrayConstructor extends TypedArrayConstructor < number , Int8Array > { }
269
254
270
- /**
271
- * Creates an array from an array-like or iterable object.
272
- * @param arrayLike An array-like or iterable object to convert to an array.
273
- * @param mapfn A mapping function to call on every element of the array.
274
- * @param thisArg Value of 'this' used to invoke the mapfn.
275
- */
276
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Uint8Array ;
277
- }
255
+ interface Uint8Array extends TypedArray < number > { }
278
256
279
- interface Uint8ClampedArray {
280
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
281
- /**
282
- * Returns an array of key, value pairs for every entry in the array
283
- */
284
- entries ( ) : IterableIterator < [ number , number ] > ;
257
+ interface Uint8ArrayConstructor extends TypedArrayConstructor < number , Uint8Array > { }
285
258
286
- /**
287
- * Returns an list of keys in the array
288
- */
289
- keys ( ) : IterableIterator < number > ;
259
+ interface Uint8ClampedArray extends TypedArray < number > { }
290
260
291
- /**
292
- * Returns an list of values in the array
293
- */
294
- values ( ) : IterableIterator < number > ;
295
- }
261
+ interface Uint8ClampedArrayConstructor extends TypedArrayConstructor < number , Uint8ClampedArray > { }
296
262
297
- interface Uint8ClampedArrayConstructor {
298
- new ( elements : Iterable < number > ) : Uint8ClampedArray ;
263
+ interface Int16Array extends TypedArray < number > { }
299
264
300
- /**
301
- * Creates an array from an array-like or iterable object.
302
- * @param arrayLike An array-like or iterable object to convert to an array.
303
- * @param mapfn A mapping function to call on every element of the array.
304
- * @param thisArg Value of 'this' used to invoke the mapfn.
305
- */
306
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Uint8ClampedArray ;
307
- }
265
+ interface Int16ArrayConstructor extends TypedArrayConstructor < number , Int16Array > { }
308
266
309
- interface Int16Array {
310
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
311
- /**
312
- * Returns an array of key, value pairs for every entry in the array
313
- */
314
- entries ( ) : IterableIterator < [ number , number ] > ;
267
+ interface Uint16Array extends TypedArray < number > { }
315
268
316
- /**
317
- * Returns an list of keys in the array
318
- */
319
- keys ( ) : IterableIterator < number > ;
269
+ interface Uint16ArrayConstructor extends TypedArrayConstructor < number , Uint16Array > { }
320
270
321
- /**
322
- * Returns an list of values in the array
323
- */
324
- values ( ) : IterableIterator < number > ;
325
- }
271
+ interface Int32Array extends TypedArray < number > { }
326
272
327
- interface Int16ArrayConstructor {
328
- new ( elements : Iterable < number > ) : Int16Array ;
273
+ interface Int32ArrayConstructor extends TypedArrayConstructor < number , Int32Array > { }
329
274
330
- /**
331
- * Creates an array from an array-like or iterable object.
332
- * @param arrayLike An array-like or iterable object to convert to an array.
333
- * @param mapfn A mapping function to call on every element of the array.
334
- * @param thisArg Value of 'this' used to invoke the mapfn.
335
- */
336
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Int16Array ;
337
- }
275
+ interface Uint32Array extends TypedArray < number > { }
338
276
339
- interface Uint16Array {
340
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
341
- /**
342
- * Returns an array of key, value pairs for every entry in the array
343
- */
344
- entries ( ) : IterableIterator < [ number , number ] > ;
345
- /**
346
- * Returns an list of keys in the array
347
- */
348
- keys ( ) : IterableIterator < number > ;
349
- /**
350
- * Returns an list of values in the array
351
- */
352
- values ( ) : IterableIterator < number > ;
353
- }
277
+ interface Uint32ArrayConstructor extends TypedArrayConstructor < number , Uint32Array > { }
354
278
355
- interface Uint16ArrayConstructor {
356
- new ( elements : Iterable < number > ) : Uint16Array ;
279
+ interface Float32Array extends TypedArray < number > { }
357
280
358
- /**
359
- * Creates an array from an array-like or iterable object.
360
- * @param arrayLike An array-like or iterable object to convert to an array.
361
- * @param mapfn A mapping function to call on every element of the array.
362
- * @param thisArg Value of 'this' used to invoke the mapfn.
363
- */
364
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Uint16Array ;
365
- }
281
+ interface Float32ArrayConstructor extends TypedArrayConstructor < number , Float32Array > { }
366
282
367
- interface Int32Array {
368
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
369
- /**
370
- * Returns an array of key, value pairs for every entry in the array
371
- */
372
- entries ( ) : IterableIterator < [ number , number ] > ;
373
- /**
374
- * Returns an list of keys in the array
375
- */
376
- keys ( ) : IterableIterator < number > ;
377
- /**
378
- * Returns an list of values in the array
379
- */
380
- values ( ) : IterableIterator < number > ;
381
- }
382
-
383
- interface Int32ArrayConstructor {
384
- new ( elements : Iterable < number > ) : Int32Array ;
385
-
386
- /**
387
- * Creates an array from an array-like or iterable object.
388
- * @param arrayLike An array-like or iterable object to convert to an array.
389
- * @param mapfn A mapping function to call on every element of the array.
390
- * @param thisArg Value of 'this' used to invoke the mapfn.
391
- */
392
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Int32Array ;
393
- }
394
-
395
- interface Uint32Array {
396
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
397
- /**
398
- * Returns an array of key, value pairs for every entry in the array
399
- */
400
- entries ( ) : IterableIterator < [ number , number ] > ;
401
- /**
402
- * Returns an list of keys in the array
403
- */
404
- keys ( ) : IterableIterator < number > ;
405
- /**
406
- * Returns an list of values in the array
407
- */
408
- values ( ) : IterableIterator < number > ;
409
- }
410
-
411
- interface Uint32ArrayConstructor {
412
- new ( elements : Iterable < number > ) : Uint32Array ;
413
-
414
- /**
415
- * Creates an array from an array-like or iterable object.
416
- * @param arrayLike An array-like or iterable object to convert to an array.
417
- * @param mapfn A mapping function to call on every element of the array.
418
- * @param thisArg Value of 'this' used to invoke the mapfn.
419
- */
420
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Uint32Array ;
421
- }
422
-
423
- interface Float32Array {
424
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
425
- /**
426
- * Returns an array of key, value pairs for every entry in the array
427
- */
428
- entries ( ) : IterableIterator < [ number , number ] > ;
429
- /**
430
- * Returns an list of keys in the array
431
- */
432
- keys ( ) : IterableIterator < number > ;
433
- /**
434
- * Returns an list of values in the array
435
- */
436
- values ( ) : IterableIterator < number > ;
437
- }
283
+ interface Float64Array extends TypedArray < number > { }
438
284
439
- interface Float32ArrayConstructor {
440
- new ( elements : Iterable < number > ) : Float32Array ;
441
-
442
- /**
443
- * Creates an array from an array-like or iterable object.
444
- * @param arrayLike An array-like or iterable object to convert to an array.
445
- * @param mapfn A mapping function to call on every element of the array.
446
- * @param thisArg Value of 'this' used to invoke the mapfn.
447
- */
448
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Float32Array ;
449
- }
450
-
451
- interface Float64Array {
452
- [ Symbol . iterator ] ( ) : IterableIterator < number > ;
453
- /**
454
- * Returns an array of key, value pairs for every entry in the array
455
- */
456
- entries ( ) : IterableIterator < [ number , number ] > ;
457
- /**
458
- * Returns an list of keys in the array
459
- */
460
- keys ( ) : IterableIterator < number > ;
461
- /**
462
- * Returns an list of values in the array
463
- */
464
- values ( ) : IterableIterator < number > ;
465
- }
466
-
467
- interface Float64ArrayConstructor {
468
- new ( elements : Iterable < number > ) : Float64Array ;
469
-
470
- /**
471
- * Creates an array from an array-like or iterable object.
472
- * @param arrayLike An array-like or iterable object to convert to an array.
473
- * @param mapfn A mapping function to call on every element of the array.
474
- * @param thisArg Value of 'this' used to invoke the mapfn.
475
- */
476
- from ( arrayLike : Iterable < number > , mapfn ?: ( v : number , k : number ) => number , thisArg ?: any ) : Float64Array ;
477
- }
285
+ interface Float64ArrayConstructor extends TypedArrayConstructor < number , Float64Array > { }
0 commit comments