@babel/plugin-proposal-class-properties

This plugin is included in @babel/preset-env, in ES2022

Below is a class with four class properties which will be transformed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class Bork {
  //Property initializer syntax
  instanceProperty = "bork";
  boundFunction = () => {
    return this.instanceProperty;
  };

  //Static class properties
  static staticProperty = "babelIsCool";
  static staticFunction = function() {
    return Bork.staticProperty;
  };
}