Trying to extend a class with a static property, but I'm getting the following type error:
Property 'property' does not exist on type 'new (...args: any[]) => T'.(2339)
class A {
static property = 'a'
}
class B extends A {}
function factory<T extends A>(type: new (...args: any[]) => T): T {
if (type.property) { // error -> Property 'property' does not exist on type 'new (...args: any[]) => T'.(2339)
console.log('heyyyyy')
}
return new type();
}
const b = factory(B);
console.log(B.property)
What must be done for this to work without the type error?
Thank you for your help.