Converts a function that takes multiple arguments into a curried function.
The tuple type of the function's arguments.
The return type of the function.
The function to curry.
Rest
const add = (a: number, b: number, c: number) => a + b + c;const curriedAdd = curry(add);console.log(curriedAdd(1)(2)(3)); // Output: 6console.log(curriedAdd(1, 2)(3)); // Output: 6console.log(curriedAdd(1)(2, 3)); // Output: 6console.log(curriedAdd(1, 2, 3)); // Output: 6 Copy
const add = (a: number, b: number, c: number) => a + b + c;const curriedAdd = curry(add);console.log(curriedAdd(1)(2)(3)); // Output: 6console.log(curriedAdd(1, 2)(3)); // Output: 6console.log(curriedAdd(1)(2, 3)); // Output: 6console.log(curriedAdd(1, 2, 3)); // Output: 6
Converts a function that takes multiple arguments into a curried function.