I've got a problem for some time
let's have this:
export abstract class abstractClass {
abstract thing(): string
}
export class c1 extends abstractClass {
thing(): string {
return "hello"
}
}
export class c2 extends abstractClass {
thing(): string {
return "world"
}
}
export interface simpleInter {
el: typeof abstractClass
}
const cls: simpleInter[] = [];
cls.push({
el: c1
},{
el: c2
})
for (const classObj of cls) {
const c = new (classObj.el)() // error: Cannot create an instance of an abstract class. ts(2511)
console.log(c.thing())
}
What I can't seems to answer is how can I make understand the compiler understand that I want as a type classes that extends my abstractClass