I'm trying to create a TypeScript function that accepts an array and returns a new function where the arguments have the types of the array.
In other words, it should be something like this:
type MyFunc = {
<A>(arg: [A]): ((arg0: A) => any)
<A, B>(arg: [A, B]): ((arg0: A, arg1: B) => any)
<A, B, C>(arg: [A, B, C]): ((arg0: A, arg1: B, arg2: C) => any)
}
But for a variable number of inputs
Concrete examples
Here's some concrete examples (even though I'm looking for the general case):
type MyFuncA = (arg: [number]) => ((arg0: number) => any)
type MyFuncB = (arg: [string]) => ((arg0: string) => any)
type MyFuncC = (arg: [number, string]) => ((arg0: number, arg1: string) => any)
type MyFuncD = (arg: [number, string, bool]) => ((arg0: number, arg1: string, arg2: bool) => any)