Skip to content

Instantly share code, notes, and snippets.

@DimitarNestorov
Created April 23, 2019 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DimitarNestorov/de3598a2de325b2cb140f74eb060c601 to your computer and use it in GitHub Desktop.
Save DimitarNestorov/de3598a2de325b2cb140f74eb060c601 to your computer and use it in GitHub Desktop.
TypeScript toolset
type PromiseType<T> = T extends Promise<infer U> ? U : T
// const myPromise = new Promise<string>(() => {})
// type MyPromiseType = PromiseType<typeof myPromise> // string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment