Skip to content

Better typings for Array.concat() #33606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1080,12 +1080,12 @@ interface ReadonlyArray<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: ConcatArray<T>[]): T[];
concat(...items: (T | ConcatArray<T>)[]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: (T | ConcatArray<T>)[]): T[];
concat<U>(...items: (U | ConcatArray<U>)[]): (T | U)[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
Expand Down Expand Up @@ -1214,12 +1214,12 @@ interface Array<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: ConcatArray<T>[]): T[];
concat(...items: (T | ConcatArray<T>)[]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: (T | ConcatArray<T>)[]): T[];
concat<U>(...items: (U | ConcatArray<U>)[]): (T | U)[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
Expand Down
12 changes: 12 additions & 0 deletions tests/baselines/reference/arrayConcat2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ a.concat('Hello');

var b = new Array<string>();
b.concat('hello');

// #26378

[""].concat([1]);

// #26976

[].concat([""]);


//// [arrayConcat2.js]
Expand All @@ -14,3 +22,7 @@ a.concat("hello", 'world');
a.concat('Hello');
var b = new Array();
b.concat('hello');
// #26378
[""].concat([1]);
// #26976
[].concat([""]);
12 changes: 12 additions & 0 deletions tests/baselines/reference/arrayConcat2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ b.concat('hello');
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

// #26378

[""].concat([1]);
>[""].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

// #26976

[].concat([""]);
>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

35 changes: 28 additions & 7 deletions tests/baselines/reference/arrayConcat2.types
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
=== tests/cases/compiler/arrayConcat2.ts ===
var a: string[] = [];
>a : string[]
>[] : undefined[]
>[] : never[]

a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>a.concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>a : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>"hello" : "hello"
>'world' : "world"

a.concat('Hello');
>a.concat('Hello') : string[]
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>a.concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>a : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>'Hello' : "Hello"

var b = new Array<string>();
Expand All @@ -25,8 +25,29 @@ var b = new Array<string>();

b.concat('hello');
>b.concat('hello') : string[]
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>b.concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>b : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>'hello' : "hello"

// #26378

[""].concat([1]);
>[""].concat([1]) : (string | number)[]
>[""].concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>[""] : string[]
>"" : ""
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>[1] : number[]
>1 : 1

// #26976

[].concat([""]);
>[].concat([""]) : string[]
>[].concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>[] : never[]
>concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>[""] : string[]
>"" : ""

4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayConcat3.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1

b.concat(a);
>b.concat(a) : Fn<T1>[]
>b.concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
>b.concat : { (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; <U>(...items: (U | ConcatArray<U>)[]): (Fn<T1> | U)[]; }
>b : Fn<T1>[]
>concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
>concat : { (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; <U>(...items: (U | ConcatArray<U>)[]): (Fn<T1> | U)[]; }
>a : Fn<T>[]
}

4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayConcatMap.types
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
>[].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
>[].concat : { (...items: any[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
>[] : undefined[]
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
>concat : { (...items: any[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
>[{ a: 1 }] : { a: number; }[]
>{ a: 1 } : { a: number; }
>a : number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'.
Property 'b' is missing in type 'A' but required in type 'B'.
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
The types returned by 'concat(...)' are incompatible between these types.
The types returned by 'slice(...)' are incompatible between these types.
Type 'A[]' is not assignable to type 'B[]'.
Type 'A' is not assignable to type 'B'.

Expand Down Expand Up @@ -31,7 +31,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
rrb = cra; // error: 'A' is not assignable to 'B'
~~~
!!! error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
!!! error TS2322: The types returned by 'concat(...)' are incompatible between these types.
!!! error TS2322: The types returned by 'slice(...)' are incompatible between these types.
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.

8 changes: 4 additions & 4 deletions tests/baselines/reference/concatError.types
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ fa = fa.concat([0]);
>fa = fa.concat([0]) : number[]
>fa : number[]
>fa.concat([0]) : number[]
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>fa.concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>fa : number[]
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>[0] : number[]
>0 : 0

fa = fa.concat(0);
>fa = fa.concat(0) : number[]
>fa : number[]
>fa.concat(0) : number[]
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>fa.concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>fa : number[]
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>0 : 0


Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/concatTuples.types
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ijs = ijs.concat([[3, 4], [5, 6]]);
>ijs = ijs.concat([[3, 4], [5, 6]]) : [number, number][]
>ijs : [number, number][]
>ijs.concat([[3, 4], [5, 6]]) : [number, number][]
>ijs.concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; }
>ijs.concat : { (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; <U>(...items: (U | ConcatArray<U>)[]): ([number, number] | U)[]; }
>ijs : [number, number][]
>concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; }
>[[3, 4], [5, 6]] : [number, number][]
>concat : { (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; <U>(...items: (U | ConcatArray<U>)[]): ([number, number] | U)[]; }
>[[3, 4], [5, 6]] : [[number, number], [number, number]]
>[3, 4] : [number, number]
>3 : 3
>4 : 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ export default class Operation {

// Commenting out this line will fix the problem.
result = (result || []).concat(innerResult);
>result = (result || []).concat(innerResult) : IValidationError[]
>result = (result || []).concat(innerResult) : any[]
>result : IValidationError[] | null
>(result || []).concat(innerResult) : IValidationError[]
>(result || []).concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
>(result || []).concat(innerResult) : any[]
>(result || []).concat : { (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; <U>(...items: (U | ConcatArray<U>)[]): (IValidationError | U)[]; }
>(result || []) : IValidationError[]
>result || [] : IValidationError[]
>result : IValidationError[] | null
>[] : never[]
>concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
>concat : { (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; <U>(...items: (U | ConcatArray<U>)[]): (IValidationError | U)[]; }
>innerResult : any
}
}
Expand Down
31 changes: 17 additions & 14 deletions tests/baselines/reference/destructuringTuple.errors.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload matches this call.
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call.
Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
Type 'number[]' is not assignable to type 'number'.
Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
Type 'number[]' is not assignable to type '[]'.
Types of property 'length' are incompatible.
Type 'number' is not assignable to type '0'.


==== tests/cases/compiler/destructuringTuple.ts (2 errors) ====
==== tests/cases/compiler/destructuringTuple.ts (1 errors) ====
declare var tuple: [boolean, number, ...string[]];

const [a, b, c, ...rest] = tuple;
Expand All @@ -18,14 +19,16 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
// Repros from #32140

const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
~~~~~
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
~~
~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
!!! error TS2769: Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
!!! error TS2769: Type 'number[]' is not assignable to type 'number'.
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
!!! error TS2769: Type 'number[]' is not assignable to type '[]'.
!!! error TS2769: Types of property 'length' are incompatible.
!!! error TS2769: Type 'number' is not assignable to type '0'.
!!! related TS6502 /.ts/lib.es5.d.ts:1350:24: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:1356:27: The expected type comes from the return type of this signature.

const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);

18 changes: 9 additions & 9 deletions tests/baselines/reference/destructuringTuple.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ declare var receiver: typeof tuple;
// Repros from #32140

const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
>oops1 : undefined
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : []
>oops1 : any
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : any
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
>[1, 2, 3] : number[]
>1 : 1
>2 : 2
>3 : 3
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
>(accu, el) => accu.concat(el) : (accu: [], el: number) => any
>(accu, el) => accu.concat(el) : (accu: [], el: number) => number[]
>accu : []
>el : number
>accu.concat(el) : any
>accu.concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
>accu.concat(el) : number[]
>accu.concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>accu : []
>concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
>concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>el : number
>[] : []
>[] : never[]

const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
>oops2 : number
Expand All @@ -54,9 +54,9 @@ const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
>acc : number[]
>e : number
>acc.concat(e) : number[]
>acc.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>acc.concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>acc : number[]
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
>concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>e : number
>[] : never[]

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any
>apply : (this: Function, thisArg: any, argArray?: any) => any
>this : any
>[ this ].concat(args) : any[]
>[ this ].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
>[ this ].concat : { (...items: any[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
>[ this ] : any[]
>this : any
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
>concat : { (...items: any[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
>args : any[]

};
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/intersectionTypeInference3.types
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ declare const b: Set<A>;
const c1 = Array.from(a).concat(Array.from(b));
>c1 : Nominal<"A", string>[]
>Array.from(a).concat(Array.from(b)) : Nominal<"A", string>[]
>Array.from(a).concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
>Array.from(a).concat : { (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; <U>(...items: (U | ConcatArray<U>)[]): (Nominal<"A", string> | U)[]; }
>Array.from(a) : Nominal<"A", string>[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>a : Set<Nominal<"A", string>>
>concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
>concat : { (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; <U>(...items: (U | ConcatArray<U>)[]): (Nominal<"A", string> | U)[]; }
>Array.from(b) : Nominal<"A", string>[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
Expand Down
Loading