forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayConcat2.types
More file actions
51 lines (43 loc) · 2.17 KB
/
arrayConcat2.types
File metadata and controls
51 lines (43 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
=== 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[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>a : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>"hello" : "hello"
>'world' : "world"
a.concat('Hello');
>a.concat('Hello') : string[]
>a.concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>a : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>'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[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>b : string[]
>concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
>'hello' : "hello"
// #19535
const [x] = (undefined as unknown as string[][]).concat([""]);
>x : string | string[]
>(undefined as unknown as string[][]).concat([""]) : (string | string[])[]
>(undefined as unknown as string[][]).concat : { (...items: ConcatArray<string[]>[]): string[][]; <U extends (string[] | ConcatArray<string[]>)[]>(...items: U): (string[] | Flatten<U[number]>)[]; }
>(undefined as unknown as string[][]) : string[][]
>undefined as unknown as string[][] : string[][]
>undefined as unknown : unknown
>undefined : undefined
>concat : { (...items: ConcatArray<string[]>[]): string[][]; <U extends (string[] | ConcatArray<string[]>)[]>(...items: U): (string[] | Flatten<U[number]>)[]; }
>[""] : string[]
>"" : ""
x == "";
>x == "" : boolean
>x : string | string[]
>"" : ""