Skip to content

Commit 10b3d73

Browse files
authored
Merge pull request #10917 from Salasar/Fix10843
Fix 10843: Change Array.prototype.findIndex method definition according to ES6 spec
2 parents bbf80a7 + df5e176 commit 10b3d73

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/lib/es2015.core.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface Array<T> {
2121
* @param thisArg If provided, it will be used as the this value for each invocation of
2222
* predicate. If it is not provided, undefined is used instead.
2323
*/
24-
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
24+
findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;
2525

2626
/**
2727
* Returns the this object after filling the section identified by start and end with value
@@ -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) => boolean, thisArg?: any): number;
371+
findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;
372372
}
373373

374374
interface RegExp {

src/lib/es5.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ interface Int8Array {
15761576
* @param thisArg If provided, it will be used as the this value for each invocation of
15771577
* predicate. If it is not provided, undefined is used instead.
15781578
*/
1579-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
1579+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
15801580

15811581
/**
15821582
* Performs the specified action for each element in an array.
@@ -1849,7 +1849,7 @@ interface Uint8Array {
18491849
* @param thisArg If provided, it will be used as the this value for each invocation of
18501850
* predicate. If it is not provided, undefined is used instead.
18511851
*/
1852-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
1852+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
18531853

18541854
/**
18551855
* Performs the specified action for each element in an array.
@@ -2123,7 +2123,7 @@ interface Uint8ClampedArray {
21232123
* @param thisArg If provided, it will be used as the this value for each invocation of
21242124
* predicate. If it is not provided, undefined is used instead.
21252125
*/
2126-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
2126+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
21272127

21282128
/**
21292129
* Performs the specified action for each element in an array.
@@ -2396,7 +2396,7 @@ interface Int16Array {
23962396
* @param thisArg If provided, it will be used as the this value for each invocation of
23972397
* predicate. If it is not provided, undefined is used instead.
23982398
*/
2399-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
2399+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
24002400

24012401
/**
24022402
* Performs the specified action for each element in an array.
@@ -2670,7 +2670,7 @@ interface Uint16Array {
26702670
* @param thisArg If provided, it will be used as the this value for each invocation of
26712671
* predicate. If it is not provided, undefined is used instead.
26722672
*/
2673-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
2673+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
26742674

26752675
/**
26762676
* Performs the specified action for each element in an array.
@@ -2943,7 +2943,7 @@ interface Int32Array {
29432943
* @param thisArg If provided, it will be used as the this value for each invocation of
29442944
* predicate. If it is not provided, undefined is used instead.
29452945
*/
2946-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
2946+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
29472947

29482948
/**
29492949
* Performs the specified action for each element in an array.
@@ -3216,7 +3216,7 @@ interface Uint32Array {
32163216
* @param thisArg If provided, it will be used as the this value for each invocation of
32173217
* predicate. If it is not provided, undefined is used instead.
32183218
*/
3219-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
3219+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
32203220

32213221
/**
32223222
* Performs the specified action for each element in an array.
@@ -3489,7 +3489,7 @@ interface Float32Array {
34893489
* @param thisArg If provided, it will be used as the this value for each invocation of
34903490
* predicate. If it is not provided, undefined is used instead.
34913491
*/
3492-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
3492+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
34933493

34943494
/**
34953495
* Performs the specified action for each element in an array.
@@ -3763,7 +3763,7 @@ interface Float64Array {
37633763
* @param thisArg If provided, it will be used as the this value for each invocation of
37643764
* predicate. If it is not provided, undefined is used instead.
37653765
*/
3766-
findIndex(predicate: (value: number) => boolean, thisArg?: any): number;
3766+
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
37673767

37683768
/**
37693769
* Performs the specified action for each element in an array.

0 commit comments

Comments
 (0)