Created
December 10, 2019 14:39
-
-
Save yaakaito/04a07fc2f121cf8cb9b25ce47bdc7434 to your computer and use it in GitHub Desktop.
TypeScript で instaceof できる Error 作るやつ
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
class MyError extends Error { | |
constructor(message: string) { | |
super(message) | |
this.name = new.target.name | |
Object.setPrototypeOf(this, new.target.prototype) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment