I am just about to learn some typed functional programming, so just started with an implementation of partial application - which should be type safe.
Problem: I am trying to make a function that takes a function and zero or all of its parameters as arguments.
So I started with that interface
interface Functor {
(...args: any[]) => any
}
And came to this function:
const partial = <T extends Functor>(fx: T, ...apply: Parameters<T>): Functor =>
(...args: any[]) => fx(...apply, ...args);
The Problem here is, that ...args: Parameter<T>
instructs typescript to ask for all parameters, but I want allow zero up to all
Is there any way to do that?