Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jeffreymorlan opened this issue May 4, 2016 · 0 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@jeffreymorlan
Copy link
Contributor

jeffreymorlan commented May 4, 2016

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants