Skip to content

Instantly share code, notes, and snippets.

@casheeeewnuts
Last active July 20, 2022 15:56
Show Gist options
  • Save casheeeewnuts/d8cd56fb7eb6f427f981c0e0dc0e3a79 to your computer and use it in GitHub Desktop.
Save casheeeewnuts/d8cd56fb7eb6f427f981c0e0dc0e3a79 to your computer and use it in GitHub Desktop.
関数をカリー化させる関数の型
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