Created
November 11, 2020 20:28
-
-
Save rob-gordon/6232e2c52a12fc585c90b7157a95797c to your computer and use it in GitHub Desktop.
Unwrap promises and thenables recursively
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
// 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