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

Cannot use class field #800

Closed
chungchi300 opened this issue May 6, 2019 · 4 comments
Closed

Cannot use class field #800

chungchi300 opened this issue May 6, 2019 · 4 comments
Labels

Comments

@chungchi300
Copy link

https://github.com/tc39/proposal-class-fields

@jdalton jdalton added the invalid label May 6, 2019
@jdalton
Copy link
Member

jdalton commented May 6, 2019

Hi @chungchi300!

We support parsing class fields. However, the Node version you use must support them.

@jdalton jdalton closed this as completed May 6, 2019
@chungchi300
Copy link
Author

I mean does it support ESnext Class Fields?
The class fields proposal allows properties to be initialized at the top of a class:

class MyClass {

  a = 1;
  b = 2;
  c = 3;

}

@jdalton
Copy link
Member

jdalton commented May 6, 2019

The esm loader supports whatever functionality native Node does. You can get class fields in Node 12 or --harmony I believe.

@dnalborczyk
Copy link
Contributor

@chungchi300 could you verify your node version?

either run node --version in the terminal, or check process.versions.node in your node app. if it's not at least v12.0, you have to either run node.js with the --harmony flag, as @jdalton suggested, or use a transpiler, like Babel.

if your node version is v12.x, and you are still running into this issue, could you provide some repro steps, or better, create a small repository?

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

3 participants