TypeScript/tests/baselines/reference/arrayConcat2.types
Nathan Shively-Sanders be0fcd5174
Array.concat now takes ConcatArray, not ReadonlyArray (#21462)
* 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.
2018-02-02 13:20:40 -08:00

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"