Created
August 29, 2017 23:06
-
-
Save veryjos/9b254cba579383dbc7ecf37484b83442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class TestParentClass { | |
abstract Test(): string; | |
} | |
class TestConcreteA { | |
Test() { | |
return "Called ConcreteA.Test()"; | |
} | |
} | |
class TestConcreteB { | |
Test() { | |
return "Called ConcreteB.Test()"; | |
} | |
} | |
let testMap = new Map<Number, { new(): TestParentClass }>([ | |
[0, TestConcreteA], | |
[1, TestConcreteB], | |
]); | |
let ctor = testMap.get(0); | |
console.log(new ctor().Test()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment