Skip to content

Instantly share code, notes, and snippets.

@Otto-Vector
Created April 10, 2022 15:32
Show Gist options
  • Save Otto-Vector/26ac994e5ce9ca64c18ddac4ddbbad5e to your computer and use it in GitHub Desktop.
Save Otto-Vector/26ac994e5ce9ca64c18ddac4ddbbad5e to your computer and use it in GitHub Desktop.
TS Extract Promise Arguments
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