Last active
August 25, 2017 08:03
-
-
Save zommarin/e8ea76addc68de513210c173d2905947 to your computer and use it in GitHub Desktop.
Various good to know TypeScript patterns
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
// Catch exception in non-async method when async method is called | |
obj.asyncMethod(arg1, arg2) | |
.catch(ex => this.handlerMethod(ex)) | |
// Get the name of an enum value as a string | |
enum MyEnum { Value1 } | |
const str = MyEnum[MyEnum.Value1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment