Created
July 9, 2020 18:53
-
-
Save nicksteffens/f5b21123fcdcaa9cf47e9f57d7706d7d 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
// Typescript Generics | |
class MyMap<T extends Error> { | |
value: T; | |
getVal() { | |
return this.value; | |
} | |
constructor(val: T) { | |
this.value = val; | |
} | |
} | |
const map1 = new MyMap(new Error('message')); | |
const value = map1.getVal(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment