swc/crates/swc_ecma_parser/tests/tsc/ES5For-of37.ts

16 lines
429 B
TypeScript
Raw Normal View History

// @downlevelIteration: true
// https://github.com/microsoft/TypeScript/issues/30083
for (const i of [0, 1, 2, 3, 4]) {
try {
// Ensure catch binding for the following loop is reset per iteration:
for (const j of [1, 2, 3]) {
if (i === 2) {
throw new Error('ERR');
}
}
console.log(i);
} catch (err) {
console.log('E %s %s', i, err);
}
}