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

Error "Class properties must be methods" #3607

Closed
Hanspe-3019 opened this issue Feb 15, 2022 · 2 comments
Closed

Error "Class properties must be methods" #3607

Hanspe-3019 opened this issue Feb 15, 2022 · 2 comments

Comments

@Hanspe-3019
Copy link

With esversion: 8 or higher, I get this error message:

Class properties must be methods, Expected '(' but instead saw '='

Sample:

class Demo {
    static staticProperty = 'A';
}
console.log(Demo.staticProperty);

Script runs as expected, yielding 'A'.

@jugglinmike
Copy link
Member

Thanks for taking the time to file an issue! The language feature you are looking for is called "numeric separators", and if you search this project's issue tracker for that term, you'll find a corresponding feature request. In order to keep things organized, I'm going to close this issue as a duplicate.

@jacobq
Copy link

jacobq commented Mar 4, 2022

The language feature you are looking for is called "numeric separators"...

This doesn't appear to have anything to do with numeric separators...but the link to class fields is correct, I guess.

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

No branches or pull requests

3 participants