Last active
July 20, 2022 15:56
-
-
Save casheeeewnuts/d8cd56fb7eb6f427f981c0e0dc0e3a79 to your computer and use it in GitHub Desktop.
関数をカリー化させる関数の型
This file contains 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 Currying<F extends (...args: any[]) => any> = F extends (...args: infer Params) => infer Returned | |
? Params extends [infer H, ...infer R] | |
? (h: H) => Currying<(...rests: R) => Returned> | |
: Params extends [infer L] | |
? (l: L) => Returned | |
: Returned | |
: never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment