My goal is to instantiate a child class within a static method of the base class using the following code:
class Baseclass {
public static create(){
const newInstance = new Childclass();
return newInstance;
}
}
class Childclass extends Baseclass {}
const anInstance = Baseclass.create();
This implementation behaves as expected. However, when attempting to split each class into separate files, I encounter the error:
TypeError: Class extends value undefined is not a constructor or null
An example can be viewed here. I suspect this issue is related to imports causing circular references. Despite successful execution when both classes are in the same file, I anticipate it should also function properly when separated into distinct files.