* Overloads in Array.concat now handle ReadonlyArray Previously it was union types, which is slower. * Make arrayConcat3 test stricter * Switch to InputArray instead of adding overloads * Update baselines * Update baselines correctly * Rename to ConcatArray and add slice method Should make it, respectively, easier to understand this specific type and harder to satisfy it by mistake.
52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
=== tests/cases/compiler/concatError.ts ===
|
|
var n1: number[];
|
|
>n1 : number[]
|
|
|
|
/*
|
|
interface Array<T> {
|
|
concat(...items: T[][]): T[]; // Note: This overload needs to be picked for arrays of arrays, even though both are applicable
|
|
concat(...items: T[]): T[];
|
|
}
|
|
*/
|
|
var fa: number[];
|
|
>fa : number[]
|
|
|
|
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 : number[]
|
|
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
|
|
>[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 : number[]
|
|
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
|
|
>0 : 0
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
declare class C<T> {
|
|
public m(p1: C<C<T>>): C<T>;
|
|
//public p: T;
|
|
}
|
|
|
|
var c: C<number>;
|
|
var cc: C<C<number>>;
|
|
|
|
c = c.m(cc);
|
|
*/
|