I have an abstract class, and classes that extend it in an array. What do I type the array?
abstract class AbstractClassToExtend {
constructor() { console.log("hello") }
}
class One extends AbstractClassToExtend {}
class Two extends AbstractClassToExtend {}
const array = [One, Two] // what do i type this array?
I've tried const array: typeof AbstractClassToExtend[] = [One, Two]
, but when making an instance of one of the classes in the array,
new array[0]()
it gives an error:
error TS2511: Cannot create an instance of an abstract class.
I'm using Typescript 4.3.2.