/
ES5For-of37.types
52 lines (46 loc) · 1.15 KB
/
ES5For-of37.types
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
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts ===
// https://github.com/microsoft/TypeScript/issues/30083
for (const i of [0, 1, 2, 3, 4]) {
>i : number
>[0, 1, 2, 3, 4] : number[]
>0 : 0
>1 : 1
>2 : 2
>3 : 3
>4 : 4
try {
// Ensure catch binding for the following loop is reset per iteration:
for (const j of [1, 2, 3]) {
>j : number
>[1, 2, 3] : number[]
>1 : 1
>2 : 2
>3 : 3
if (i === 2) {
>i === 2 : boolean
>i : number
>2 : 2
throw new Error('ERR');
>new Error('ERR') : Error
>Error : ErrorConstructor
>'ERR' : "ERR"
}
}
console.log(i);
>console.log(i) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>i : number
} catch (err) {
>err : any
console.log('E %s %s', i, err);
>console.log('E %s %s', i, err) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>'E %s %s' : "E %s %s"
>i : number
>err : any
}
}