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
53 lines (44 loc) · 1.92 KB
/
arrayConcat2.types
File metadata and controls
53 lines (44 loc) · 1.92 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
52
53
=== tests/cases/compiler/arrayConcat2.ts ===
var a: string[] = [];
>a : string[]
>[] : never[]
a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
>a.concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>a : 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: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>a : string[]
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>'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: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>b : 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[]
>"" : ""