Skip to content

Instantly share code, notes, and snippets.

@rob-gordon
Created November 11, 2020 20:28
Show Gist options
  • Save rob-gordon/6232e2c52a12fc585c90b7157a95797c to your computer and use it in GitHub Desktop.
Save rob-gordon/6232e2c52a12fc585c90b7157a95797c to your computer and use it in GitHub Desktop.
Unwrap promises and thenables recursively
// From https://stackoverflow.com/questions/48011353/how-to-unwrap-type-of-a-promise/57364353#57364353
type Await<T> = T extends PromiseLike<infer U> ? Await<U> : T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment