Skip to content

Instantly share code, notes, and snippets.

@i-mighty
Created January 24, 2022 13:22
Show Gist options
  • Save i-mighty/cfbf67d19c63a248b4d405e96057c1ea to your computer and use it in GitHub Desktop.
Save i-mighty/cfbf67d19c63a248b4d405e96057c1ea to your computer and use it in GitHub Desktop.
Unwrap Return type from Promises
export type Unwrap<T> = T extends Promise<infer U>
? U
: T extends (...args: any) => Promise<infer U>
? U
: T extends (...args: any) => infer U
? U
: T;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment