Skip to content

Emit destructuring patterns in 'for...in' statements for ES3/5 #2272

Closed as not planned
@JsonFreeman

Description

@JsonFreeman

The following is allowed by the ES6 grammar:

for (var [a, b] in []) { }

This results in a type check error, because it doesn't make sense to destructure a string key. But it should still emit correctly downlevel. Right now we emit:

for (var _a = void 0, a = _a[0], b = _a[1] in []) { }

which is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions