Open
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.