-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JS EmitThe issue relates to the emission of JavaScriptThe issue relates to the emission of JavaScriptES6Relates to the ES6 SpecRelates to the ES6 Spec
Milestone
Description
We report an error for the following code, :
for (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern.
console.log(toString);
}We also emit the following incorrect javascript:
for (var toString = (void 0).toString in { a: 1 }) {
console.log(toString);
}We should instead emit:
for (var _a in { a: 1 }) {
var toString = _a.toString;
console.log(toString);
}While it is unlikely this will be very useful, this is another of the ES6 compatibility tests on the kangax compatibility table that we could consider addressing as it seems a small enough change.
cronon, benlesh, bartenra and Josh-Cena
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JS EmitThe issue relates to the emission of JavaScriptThe issue relates to the emission of JavaScriptES6Relates to the ES6 SpecRelates to the ES6 Spec