Skip to content

Instantly share code, notes, and snippets.

@latant
Created October 13, 2022 06:15
Show Gist options
  • Save latant/482256e47bff6b6f75751b8503387d25 to your computer and use it in GitHub Desktop.
Save latant/482256e47bff6b6f75751b8503387d25 to your computer and use it in GitHub Desktop.
Function currying type in TypeScript
type Curry<F> = F extends (arg: infer A, ...args: infer Rest) => infer R
? (arg: A) => Rest extends [any] ? Curry<(...args: Rest) => R> : R
: never;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment