Skip to content

Instantly share code, notes, and snippets.

@veryjos
Created August 29, 2017 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veryjos/9b254cba579383dbc7ecf37484b83442 to your computer and use it in GitHub Desktop.
Save veryjos/9b254cba579383dbc7ecf37484b83442 to your computer and use it in GitHub Desktop.
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