-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript 1.7.5 does not support the block scope for y here when emitting code for ES5:
function test() {
let x = 42;
{
let x = 43;
console.log(x);
}
{
let y = 77;
console.log(y);
}
{
let y = 88;
console.log(y);
}
}
Compilation result:
function test() {
var x = 42;
{
var x_1 = 43;
console.log(x_1);
}
{
var y = 77;
console.log(y);
}
{
var y = 88;
console.log(y);
}
}
At least one of the y's should also have been renamed.
(In my "real" code instead of "console.log()" there are local functions that use y and are registered as callbacks. The first function incorrectly uses the value from the second block.)
Related to #1690
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue