Files
test-repo/changelog_unreleased/javascript/pr-9408.md
T
Sosuke Suzuki 13f3336bba Support class-static-block proposal (#9476)
* Support class-static-block proposal

* Update changelog
2020-10-23 20:09:07 +09:00

1.1 KiB

Update to @babel/parser 7.12 (#9408, #9476 by @sosukesuzuki)

Updated the JavaScript parser to @babel/parser 7.12. This fixes several bugs and supports some new syntax.

Support Import Assertions

The "module attributes" proposal supported on 2.1 has been significantly changed and also renamed to "import assertions".

import json from "./foo.json" assert { type: "json" };
Support imports and exports with string names

Due to a bug in @babel/parser, Prettier can only use exports, but that will be fixed.

let happy = "happy";
export { happy as "😃" };
Support class static blocks
class C {
  static #x = 42;
  static y;
  static {
    try {
      this.y = doSomethingWith(this.#x);
    } catch {
      this.y = "unknown";
    }
  }
}