Created
October 13, 2022 06:15
-
-
Save latant/482256e47bff6b6f75751b8503387d25 to your computer and use it in GitHub Desktop.
Function currying type in TypeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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