This piece of code translates from Babel and TypeScript and works as expected.
class ParentClass { static staticProp = true; method() { console.log(this.constructor.staticProp); } } class ChildClass extends ParentClass { static staticProp = false; } (new ChildClass).method();
The requirement here is to reference the static property of the current class (via this.constructor ) instead of explicitly specifying the class, so you can inherit the method and use the corresponding static property in the child classes.
This is normal for Babylon, and TypeScript compiles it too, but it throws
error TS2339: property 'staticProp' does not exist in type 'Function'.
when compiling.
How can I handle this case to TypeScript?
estus source share