What is the Typescript type of a constructor function?
Here is an example of what I mean which throws this warning:
TS2507: Type 'Function' is not a constructor function type.
What type do I need to define clazz as here ?
class A {
foo() {console.log("bar")};
}
console.log(typeof A);
// function
function Factory(clazz: Function) : any {
class B extends clazz {
// Type 'Function' is not a constructor function type.
}
return B;
}
class Foo extends Factory(A) {}
new Foo().foo();
If I suppress the TS warning this code will execute and print out the expected result of bar