-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version 2.6.2
Code
example1.ts
let i = 1;
for (i = 0; i < 10; ++i) let i = 2;example1.js
var i = 1;
for (i_1 = 0; i_1 < 10; ++i_1)
var i_1 = 2;example2.ts
let i = 1;
for (i = 0; i < 10; ++i) { let i = 2; }example2.js
var i = 1;
for (i = 0; i < 10; ++i) {
var i_1 = 2;
}Expected behavior:
example1.ts and example2.ts are identical and shows us an ability to declare variables with the same name in the inner scope. In both cases counter variable for for statement should be used from the outer scope.
Actual behavior:
example1.ts fail compilation. Counter variable became global with the name of inner scope variable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug