The question is how to get access to class static properties from within a constructor before super method was called?
class A
{
constructor(input) {
console.log('A', typeof new.target);
}
}
class B extends A
{
static template = '';
constructor() {
console.log('B', typeof new.target);
super();
}
}
class C extends B
{
static template = 'CCC';
}
new C();
For some reason I got:
B undefined
A undefined
instead of
B function
A function
I've already asked this question about a year ago. For now, the solution provided in it is no more workable.
You can try the code in babel console. The interesting part is that this code works fine without babel (e.g. in latest Chrome), and when es2015 checkbox is off.