TypeScript/tests/baselines/reference/controlFlowAliasingCatchVariables(useunknownincatchvariables=false).js

52 lines
966 B
TypeScript

//// [controlFlowAliasingCatchVariables.ts]
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
}
}
//// [controlFlowAliasingCatchVariables.js]
try { }
catch (e) {
var isString = typeof e === 'string';
if (isString) {
e.toUpperCase(); // e string
}
if (typeof e === 'string') {
e.toUpperCase(); // e string
}
}
try { }
catch (e) {
var isString = typeof e === 'string';
e = 1;
if (isString) {
e.toUpperCase(); // e any/unknown
}
if (typeof e === 'string') {
e.toUpperCase(); // e string
}
}