File: destructuringCatch.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (64 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/es6/destructuring/destructuringCatch.ts ===
try {
    throw [0, 1];
>[0, 1] : number[]
>0 : 0
>1 : 1
}
catch ([a, b]) {
>a : any
>b : any

    a + b;
>a + b : any
>a : any
>b : any
}

try {
    throw { a: 0, b: 1 };
>{ a: 0, b: 1 } : { a: number; b: number; }
>a : number
>0 : 0
>b : number
>1 : 1
}
catch ({a, b}) {
>a : any
>b : any

    a + b;
>a + b : any
>a : any
>b : any
}

try {
    throw [{ x: [0], z: 1 }];
>[{ x: [0], z: 1 }] : { x: number[]; z: number; }[]
>{ x: [0], z: 1 } : { x: number[]; z: number; }
>x : number[]
>[0] : number[]
>0 : 0
>z : number
>1 : 1
}
catch ([{x: [y], z}]) {
>x : any
>y : any
>z : any

    y + z;
>y + z : any
>y : any
>z : any
}

// Test of comment ranges. A fix to GH#11755 should update this.
try {
}
catch (/*Test comment ranges*/[/*a*/a]) {
>a : any

}