class Base {
x = 1;
method() { return 2; }
}
class Sub extends Base {
z = this.x + super.method();
constructor() {
const instance = Reflect.construct(Base, [], new.target);
new.initialize(instance);
return instance;
}
}
const instance = new Sub();
console.log(instance.z)
Just so that we're thinking about it. The this binding should be easy, but I'm not 100% sure how to change the super binding? Does it just work?