swc/crates/swc_ecma_parser/tests/tsc/controlFlowAliasingCatchVariables.ts
2022-02-04 17:08:38 +09:00

29 lines
473 B
TypeScript

// @useUnknownInCatchVariables: true,false
try {}
catch (e) {
const isString = typeof e === 'string';
if (isString) {
e.toUpperCase(); // e string
}
if (typeof e === 'string') {
e.toUpperCase(); // e string
}
}
try {}
catch (e) {
const isString = typeof e === 'string';
e = 1;
if (isString) {
e.toUpperCase(); // e any/unknown
}
if (typeof e === 'string') {
e.toUpperCase(); // e string
}
}