problem description
after using babel,class inheritance, the new.target of the parent class is equal to undefined. Is there a solution?
the environmental background of the problems and what methods you have tried
https://github.com/babel/babe...
related codes
var A = class A {
constructor() {
console.log(new.target, "a");
}
}
var B = class B extends A {
constructor() {
super();
console.log(new.target, "b");
}
}
var obj = new B("b"); // false
running directly on node returns
[Function: B] "a"
[Function: B] "b"
but if babel is used, it returns
undefined "a"
[Function: B] "b"