#2111·esprima

Static property fails to parse

Author: OndrejSpanelCreated Feb 25, 2022Updated Feb 27, 2022

Steps to reproduce

Parse following code:

javascript
class ClassWithStaticMethod {
  static staticProperty = 'someValue';
}

The code fails to parse, this can be reproduced using https://esprima.org/demo/parse.html

Actual output

The error is:

Error: Line 2: Unexpected token =

Relevant references

The code is extracted from example https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static