mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
36 lines
562 B
TypeScript
36 lines
562 B
TypeScript
//// [tests/cases/compiler/controlFlowFinallyNoCatchAssignments.ts] ////
|
|
|
|
//// [controlFlowFinallyNoCatchAssignments.ts]
|
|
let x: number;
|
|
x = Math.random();
|
|
let a: number;
|
|
try {
|
|
if (x) {
|
|
a = 1;
|
|
} else {
|
|
a = 2;
|
|
}
|
|
} finally {
|
|
console.log(x);
|
|
}
|
|
|
|
console.log(a); // <- error here
|
|
|
|
//// [controlFlowFinallyNoCatchAssignments.js]
|
|
"use strict";
|
|
let x;
|
|
x = Math.random();
|
|
let a;
|
|
try {
|
|
if (x) {
|
|
a = 1;
|
|
}
|
|
else {
|
|
a = 2;
|
|
}
|
|
}
|
|
finally {
|
|
console.log(x);
|
|
}
|
|
console.log(a); // <- error here
|