Skip to content

Commit dd27ed5

Browse files
authored
Better typings for Array.map()
1 parent afe6f4c commit dd27ed5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/es5.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ interface ReadonlyArray<T> {
11381138
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
11391139
* @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.
11401140
*/
1141-
map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
1141+
map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): { -readonly [P in keyof this]: U };
11421142
/**
11431143
* Returns the elements of an array that meet the condition specified in a callback function.
11441144
* @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.
@@ -1308,7 +1308,7 @@ interface Array<T> {
13081308
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
13091309
* @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.
13101310
*/
1311-
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
1311+
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): { -readonly [P in keyof this]: U };
13121312
/**
13131313
* Returns the elements of an array that meet the condition specified in a callback function.
13141314
* @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.

0 commit comments

Comments
 (0)