Skip to content

Instantly share code, notes, and snippets.

@wolak041
Last active May 16, 2023 16:37
Show Gist options
  • Save wolak041/9b6b9f9c4c48836e8d3f83f4b7a9b44a to your computer and use it in GitHub Desktop.
Save wolak041/9b6b9f9c4c48836e8d3f83f4b7a9b44a to your computer and use it in GitHub Desktop.
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : any;
// void
type Example1 = ReturnType<(n: number, s: string) => void>;
// any
type Example2 = ReturnType<number>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment