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

Failure when using class properties with calculated name. #787

Closed
coreyfarrell opened this issue Apr 26, 2019 · 1 comment
Closed

Failure when using class properties with calculated name. #787

coreyfarrell opened this issue Apr 26, 2019 · 1 comment
Labels

Comments

@coreyfarrell
Copy link

const kSymbol = Symbol();

class Foo {
	[kSymbol] = 1;
}

export default new Foo()[kSymbol];

The above fails when run under esm, the [kSymbol] = 1; throws a syntax error (under node.js 12). node.js 12 has no problem with this syntax, replacing export default with module.exports = makes this code work even with esm (I assume ESM detects lack of import/export and disables itself).

@dnalborczyk
Copy link
Contributor

thank you @coreyfarrell! seems to be a parser issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants