Created
April 8, 2018 17:52
-
-
Save denistsyplakov/1002d8a34a5a886d4ac8159df494c68d to your computer and use it in GitHub Desktop.
Typescript How to create class instance from its reference
This file contains hidden or 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
class A { | |
public do(): void { | |
console.log("do A!"); | |
} | |
} | |
class B extends A { | |
public do() { | |
console.log("do B!"); | |
} | |
} | |
let ref: typeof A = B; | |
let a: A = new ref(); | |
a.do(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment