* 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.
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
=== tests/cases/compiler/arrayConcat2.ts ===
|
|
var a: string[] = [];
|
|
>a : string[]
|
|
>[] : undefined[]
|
|
|
|
a.concat("hello", 'world');
|
|
>a.concat("hello", 'world') : string[]
|
|
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>a : string[]
|
|
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>"hello" : "hello"
|
|
>'world' : "world"
|
|
|
|
a.concat('Hello');
|
|
>a.concat('Hello') : string[]
|
|
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>a : string[]
|
|
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>'Hello' : "Hello"
|
|
|
|
var b = new Array<string>();
|
|
>b : string[]
|
|
>new Array<string>() : string[]
|
|
>Array : ArrayConstructor
|
|
|
|
b.concat('hello');
|
|
>b.concat('hello') : string[]
|
|
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>b : string[]
|
|
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
|
|
>'hello' : "hello"
|
|
|