Skip to content

Bad ES6 emit accessing named class-expression in its own static initializer #8467

@jeffreymorlan

Description

@jeffreymorlan
let c = class NCE {
    static x = 1;
    static y = NCE.x * 2;
}

Output with --target ES6:

let c = (_a = class NCE {
    },
    _a.x = 1,
    _a.y = NCE.x * 2,
    _a);
var _a;

This fails at runtime as the class expression's name is out of scope.

(Inspired by #8363)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions