Created
April 10, 2022 15:32
-
-
Save Otto-Vector/26ac994e5ce9ca64c18ddac4ddbbad5e to your computer and use it in GitHub Desktop.
TS Extract Promise Arguments
This file contains hidden or 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
type Foo = Promise<{a: number}> | |
type ExtractPromiseArg<X> = X extends Promise<infer T> ? T : never | |
type FooArg = ExtractPromiseArg<Foo> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment