Skip to content

Instantly share code, notes, and snippets.

@zommarin
Last active August 25, 2017 08:03
Show Gist options
  • Save zommarin/e8ea76addc68de513210c173d2905947 to your computer and use it in GitHub Desktop.
Save zommarin/e8ea76addc68de513210c173d2905947 to your computer and use it in GitHub Desktop.
Various good to know TypeScript patterns
// 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