Merge pull request #26112 from rhys-vdw/22685-array-flat-fix

Fix issue with Array#flatMap callback return type
This commit is contained in:
Ryan Cavanaugh
2018-09-05 11:55:42 -07:00
committed by GitHub
5 changed files with 65 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ interface ReadonlyArray<T> {
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|U[],
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
thisArg?: This
): U[]
@@ -125,7 +125,7 @@ interface Array<T> {
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|U[],
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
thisArg?: This
): U[]