Skip to content

Commit 23378a1

Browse files
Fix Bugs and Add Tests
1 parent d6eb6f8 commit 23378a1

File tree

77 files changed

+4696
-294
lines changed

Some content is hidden

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

77 files changed

+4696
-294
lines changed

src/lib/es2015.core.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface Array<T> {
88
* @param thisArg If provided, it will be used as the this value for each invocation of
99
* predicate. If it is not provided, undefined is used instead.
1010
*/
11-
find<S extends T>(predicate: (value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
11+
find<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;
1212

1313
/**
1414
* Returns the value of the first element in the array where predicate is true, and undefined
@@ -19,7 +19,7 @@ interface Array<T> {
1919
* @param thisArg If provided, it will be used as the this value for each invocation of
2020
* predicate. If it is not provided, undefined is used instead.
2121
*/
22-
find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
22+
find(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;
2323

2424
/**
2525
* Returns the index of the first element in the array where predicate is true, and -1
@@ -30,7 +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-
findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
33+
findIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
3434

3535
/**
3636
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
@@ -40,7 +40,7 @@ interface Array<T> {
4040
* @param end index to stop filling the array at. If end is negative, it is treated as
4141
* length + end.
4242
*/
43-
fill(value: T, start?: number, end?: number): this;
43+
fill(value: T, start?: number, end?: number): T[];
4444

4545
/**
4646
* Returns the this object after copying a section of the array identified by start and end
@@ -51,7 +51,7 @@ interface Array<T> {
5151
* is treated as length + end.
5252
* @param end If not specified, length of the this object is used as its default value.
5353
*/
54-
copyWithin(target: number, start: number, end?: number): this;
54+
copyWithin(target: number, start: number, end?: number): T[];
5555
}
5656

5757
interface ArrayConstructor {
@@ -346,7 +346,7 @@ interface ReadonlyArray<T> {
346346
* @param thisArg If provided, it will be used as the this value for each invocation of
347347
* predicate. If it is not provided, undefined is used instead.
348348
*/
349-
find<S extends T>(predicate: (value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
349+
find<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
350350

351351
/**
352352
* Returns the value of the first element in the array where predicate is true, and undefined
@@ -357,7 +357,7 @@ interface ReadonlyArray<T> {
357357
* @param thisArg If provided, it will be used as the this value for each invocation of
358358
* predicate. If it is not provided, undefined is used instead.
359359
*/
360-
find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
360+
find(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
361361

362362
/**
363363
* Returns the index of the first element in the array where predicate is true, and -1
@@ -368,7 +368,7 @@ interface ReadonlyArray<T> {
368368
* @param thisArg If provided, it will be used as the this value for each invocation of
369369
* predicate. If it is not provided, undefined is used instead.
370370
*/
371-
findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
371+
findIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
372372
}
373373

374374
interface RegExp {

src/lib/es2015.iterable.d.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ interface String {
223223
interface Int8Array {
224224
[Symbol.iterator](): IterableIterator<number>;
225225
/**
226-
* Returns an array of key, value pairs for every entry in the array
226+
* Yields index, value pairs for every entry in the array.
227227
*/
228228
entries(): IterableIterator<[number, number]>;
229229
/**
230-
* Returns an list of keys in the array
230+
* Yields each index in the array.
231231
*/
232232
keys(): IterableIterator<number>;
233233
/**
234-
* Returns an list of values in the array
234+
* Yields each value in the array.
235235
*/
236236
values(): IterableIterator<number>;
237237
}
@@ -257,15 +257,15 @@ interface Int8ArrayConstructor {
257257
interface Uint8Array {
258258
[Symbol.iterator](): IterableIterator<number>;
259259
/**
260-
* Returns an array of key, value pairs for every entry in the array
260+
* Yields index, value pairs for every entry in the array.
261261
*/
262262
entries(): IterableIterator<[number, number]>;
263263
/**
264-
* Returns an list of keys in the array
264+
* Yields each index in the array.
265265
*/
266266
keys(): IterableIterator<number>;
267267
/**
268-
* Returns an list of values in the array
268+
* Yields each value in the array.
269269
*/
270270
values(): IterableIterator<number>;
271271
}
@@ -291,17 +291,17 @@ interface Uint8ArrayConstructor {
291291
interface Uint8ClampedArray {
292292
[Symbol.iterator](): IterableIterator<number>;
293293
/**
294-
* Returns an array of key, value pairs for every entry in the array
294+
* Yields index, value pairs for every entry in the array.
295295
*/
296296
entries(): IterableIterator<[number, number]>;
297297

298298
/**
299-
* Returns an list of keys in the array
299+
* Yields each index in the array.
300300
*/
301301
keys(): IterableIterator<number>;
302302

303303
/**
304-
* Returns an list of values in the array
304+
* Yields each value in the array.
305305
*/
306306
values(): IterableIterator<number>;
307307
}
@@ -327,17 +327,17 @@ interface Uint8ClampedArrayConstructor {
327327
interface Int16Array {
328328
[Symbol.iterator](): IterableIterator<number>;
329329
/**
330-
* Returns an array of key, value pairs for every entry in the array
330+
* Yields index, value pairs for every entry in the array.
331331
*/
332332
entries(): IterableIterator<[number, number]>;
333333

334334
/**
335-
* Returns an list of keys in the array
335+
* Yields each index in the array.
336336
*/
337337
keys(): IterableIterator<number>;
338338

339339
/**
340-
* Returns an list of values in the array
340+
* Yields each value in the array.
341341
*/
342342
values(): IterableIterator<number>;
343343
}
@@ -363,15 +363,15 @@ interface Int16ArrayConstructor {
363363
interface Uint16Array {
364364
[Symbol.iterator](): IterableIterator<number>;
365365
/**
366-
* Returns an array of key, value pairs for every entry in the array
366+
* Yields index, value pairs for every entry in the array.
367367
*/
368368
entries(): IterableIterator<[number, number]>;
369369
/**
370-
* Returns an list of keys in the array
370+
* Yields each index in the array.
371371
*/
372372
keys(): IterableIterator<number>;
373373
/**
374-
* Returns an list of values in the array
374+
* Yields each value in the array.
375375
*/
376376
values(): IterableIterator<number>;
377377
}
@@ -397,15 +397,15 @@ interface Uint16ArrayConstructor {
397397
interface Int32Array {
398398
[Symbol.iterator](): IterableIterator<number>;
399399
/**
400-
* Returns an array of key, value pairs for every entry in the array
400+
* Yields index, value pairs for every entry in the array.
401401
*/
402402
entries(): IterableIterator<[number, number]>;
403403
/**
404-
* Returns an list of keys in the array
404+
* Yields each index in the array.
405405
*/
406406
keys(): IterableIterator<number>;
407407
/**
408-
* Returns an list of values in the array
408+
* Yields each value in the array.
409409
*/
410410
values(): IterableIterator<number>;
411411
}
@@ -431,15 +431,15 @@ interface Int32ArrayConstructor {
431431
interface Uint32Array {
432432
[Symbol.iterator](): IterableIterator<number>;
433433
/**
434-
* Returns an array of key, value pairs for every entry in the array
434+
* Yields index, value pairs for every entry in the array.
435435
*/
436436
entries(): IterableIterator<[number, number]>;
437437
/**
438-
* Returns an list of keys in the array
438+
* Yields each index in the array.
439439
*/
440440
keys(): IterableIterator<number>;
441441
/**
442-
* Returns an list of values in the array
442+
* Yields each value in the array.
443443
*/
444444
values(): IterableIterator<number>;
445445
}
@@ -465,15 +465,15 @@ interface Uint32ArrayConstructor {
465465
interface Float32Array {
466466
[Symbol.iterator](): IterableIterator<number>;
467467
/**
468-
* Returns an array of key, value pairs for every entry in the array
468+
* Yields index, value pairs for every entry in the array.
469469
*/
470470
entries(): IterableIterator<[number, number]>;
471471
/**
472-
* Returns an list of keys in the array
472+
* Yields each index in the array.
473473
*/
474474
keys(): IterableIterator<number>;
475475
/**
476-
* Returns an list of values in the array
476+
* Yields each value in the array.
477477
*/
478478
values(): IterableIterator<number>;
479479
}
@@ -499,15 +499,15 @@ interface Float32ArrayConstructor {
499499
interface Float64Array {
500500
[Symbol.iterator](): IterableIterator<number>;
501501
/**
502-
* Returns an array of key, value pairs for every entry in the array
502+
* Yields index, value pairs for every entry in the array.
503503
*/
504504
entries(): IterableIterator<[number, number]>;
505505
/**
506-
* Returns an list of keys in the array
506+
* Yields each index in the array.
507507
*/
508508
keys(): IterableIterator<number>;
509509
/**
510-
* Returns an list of values in the array
510+
* Yields each value in the array.
511511
*/
512512
values(): IterableIterator<number>;
513513
}

src/lib/es2019.array.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ interface Array<T> {
3838
* @param thisArg An object to which the this keyword can refer in the callback function. If
3939
* thisArg is omitted, undefined is used as the this value.
4040
*/
41-
flatMap<U> (callback: (value: T, index: number, array: T[]) => U | ReadonlyArray<U>, thisArg?: any): U[]
41+
flatMap<U>(callback: (value: T, index: number, array: T[]) => U | ReadonlyArray<U>, thisArg?: any): U[]
4242

4343
/**
4444
* Returns a new array with all sub-array elements concatenated into it recursively up to the

src/lib/es2020.bigint.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ interface BigInt64Array {
350350
*/
351351
subarray(begin?: number, end?: number): BigInt64Array;
352352

353-
/** Converts the array to a string by using the current locale. */
353+
/** Returns a string representation of the array in the current locale. */
354354
toLocaleString(): string;
355355

356356
/** Returns a string representation of the array. */
357357
toString(): string;
358358

359-
/** Returns the primitive value of the specified object. */
359+
/** Returns the primitive value of the array. */
360360
valueOf(): BigInt64Array;
361361

362362
/** Yields each value in the array. */
@@ -627,13 +627,13 @@ interface BigUint64Array {
627627
*/
628628
subarray(begin?: number, end?: number): BigUint64Array;
629629

630-
/** Converts the array to a string by using the current locale. */
630+
/** Returns a string representation of the array in the current locale. */
631631
toLocaleString(): string;
632632

633633
/** Returns a string representation of the array. */
634634
toString(): string;
635635

636-
/** Returns the primitive value of the specified object. */
636+
/** Returns the primitive value of the array. */
637637
valueOf(): BigUint64Array;
638638

639639
/** Yields each value in the array. */

0 commit comments

Comments
 (0)