I want to have a variable to stores a class instance array, but I want to specify the data type as anything that inherits from a 'base' class. This better demonstrated by example:
class Mom { } //Base class
class Son extends Mom { }
class Daughter extends Mom { }
//What is the syntax for this?
let example : <T extends Mom>T[] = [ ]; //This array should store anyting that extends 'Mom'
//The this would be possible
example.push(new Mom());
example.push(new Son());
example.push(new Daughter());
Thanks in advance.
let example = [] as Mom[];?