Of course there is. Your code is correct minus the return type of the GetTypes
function. (To be clear Steve's answer would solve your issue as well, this is just another approach without making use of interfaces).
Change the return type of the GetTypes
function to:
function GetTypes(): Array<typeof Type>
{
return [Type1, Type2];
}
This should to the trick.