Skip to content

Commit 68c9099

Browse files
committed
fix(lib): Loosen Array predicate return types
1 parent 6487d1f commit 68c9099

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/lib/es2015.core.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Array<T> {
99
* predicate. If it is not provided, undefined is used instead.
1010
*/
1111
find<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
12-
find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined;
12+
find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
1313

1414
/**
1515
* Returns the index of the first element in the array where predicate is true, and -1
@@ -20,7 +20,7 @@ interface Array<T> {
2020
* @param thisArg If provided, it will be used as the this value for each invocation of
2121
* predicate. If it is not provided, undefined is used instead.
2222
*/
23-
findIndex(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number;
23+
findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
2424

2525
/**
2626
* Returns the this object after filling the section identified by start and end with value
@@ -324,7 +324,7 @@ interface ReadonlyArray<T> {
324324
* predicate. If it is not provided, undefined is used instead.
325325
*/
326326
find<S extends T>(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => value is S, thisArg?: any): S | undefined;
327-
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
327+
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): T | undefined;
328328

329329
/**
330330
* Returns the index of the first element in the array where predicate is true, and -1
@@ -335,7 +335,7 @@ interface ReadonlyArray<T> {
335335
* @param thisArg If provided, it will be used as the this value for each invocation of
336336
* predicate. If it is not provided, undefined is used instead.
337337
*/
338-
findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): number;
338+
findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): number;
339339
}
340340

341341
interface RegExp {

src/lib/es5.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1273,13 +1273,13 @@ interface Array<T> {
12731273
* @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
12741274
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
12751275
*/
1276-
every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
1276+
every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
12771277
/**
12781278
* Determines whether the specified callback function returns true for any element of an array.
12791279
* @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
12801280
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
12811281
*/
1282-
some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
1282+
some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
12831283
/**
12841284
* Performs the specified action for each element in an array.
12851285
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
@@ -1303,7 +1303,7 @@ interface Array<T> {
13031303
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
13041304
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
13051305
*/
1306-
filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];
1306+
filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
13071307
/**
13081308
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
13091309
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

0 commit comments

Comments
 (0)