Skip to content

Incorrect downlevel compilation for block scoped bindings captured in class initializers #7714

Closed
@vladima

Description

@vladima
let ar = [];
for (let i = 0; i < 2; i++) {
  ar.push(class { x = i; });
}
console.log(new ar[0]().x); // should this be 0, now prints 2
console.log(new ar[1]().x); // should this be 1, now prints 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions