Skip to content

Instantly share code, notes, and snippets.

@nicu-chiciuc
Created October 20, 2019 12:21
Show Gist options
  • Save nicu-chiciuc/b7e19f5ab1f4a6f6fc4ba5c235880c36 to your computer and use it in GitHub Desktop.
Save nicu-chiciuc/b7e19f5ab1f4a6f6fc4ba5c235880c36 to your computer and use it in GitHub Desktop.
// Origin: https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : any;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment