I can create a generic currying function for functions with a set number of arguments. IE)
function curry2<T1,T2,R>(func:(arg1:T1, arg2:T2) => R, param2: T2):(arg:T1) => R{
return (param1:T1) => func(param1, param2);
};
However, I cannot find a (typesafe) way to implement a generic curry function for a function with any number of arguments. In a different language I would name all my currying functions (ie: curry1, curry2, curry3, etc) the same thing (curry) and then have function overloading do the work of running the correct implementation of curry. However, typescript does not allow function overloading like this.
It isn't too bothersome to have to write curry2/curry1/curry3 everywhere instead of a single unified interface of curry, but if there is a way to do it I would appreciate knowing how!