forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeclarationEmitDestructuringArrayPattern1.types
More file actions
71 lines (63 loc) · 1.51 KB
/
declarationEmitDestructuringArrayPattern1.types
File metadata and controls
71 lines (63 loc) · 1.51 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//// [tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts] ////
=== declarationEmitDestructuringArrayPattern1.ts ===
var [] = [1, "hello"]; // Dont emit anything
>[1, "hello"] : (string | number)[]
> : ^^^^^^^^^^^^^^^^^^^
>1 : 1
> : ^
>"hello" : "hello"
> : ^^^^^^^
var [x] = [1, "hello"]; // emit x: number
>x : number
> : ^^^^^^
>[1, "hello"] : [number, string]
> : ^^^^^^^^^^^^^^^^
>1 : 1
> : ^
>"hello" : "hello"
> : ^^^^^^^
var [x1, y1] = [1, "hello"]; // emit x1: number, y1: string
>x1 : number
> : ^^^^^^
>y1 : string
> : ^^^^^^
>[1, "hello"] : [number, string]
> : ^^^^^^^^^^^^^^^^
>1 : 1
> : ^
>"hello" : "hello"
> : ^^^^^^^
var [, , z1] = [0, 1, 2]; // emit z1: number
>z1 : number
> : ^^^^^^
>[0, 1, 2] : [number, number, number]
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>0 : 0
> : ^
>1 : 1
> : ^
>2 : 2
> : ^
var a = [1, "hello"];
>a : (string | number)[]
> : ^^^^^^^^^^^^^^^^^^^
>[1, "hello"] : (string | number)[]
> : ^^^^^^^^^^^^^^^^^^^
>1 : 1
> : ^
>"hello" : "hello"
> : ^^^^^^^
var [x2] = a; // emit x2: number | string
>x2 : string | number
> : ^^^^^^^^^^^^^^^
>a : (string | number)[]
> : ^^^^^^^^^^^^^^^^^^^
var [x3, y3, z3] = a; // emit x3, y3, z3
>x3 : string | number
> : ^^^^^^^^^^^^^^^
>y3 : string | number
> : ^^^^^^^^^^^^^^^
>z3 : string | number
> : ^^^^^^^^^^^^^^^
>a : (string | number)[]
> : ^^^^^^^^^^^^^^^^^^^