Imagine a scenario where I have a tool that provides types with the following structure:
type FunctionA<In, Out> = (input: In) => Out;
Additionally, there is another tool in the form of a method that has a mirrored format like this:
const funcB = <Out, In>(input: In) => input as any as Out;
What I aim to achieve is creating a function that can automatically infer types from the first tool and utilize them to call the second tool. While my attempt may not be accurate, the concept would look something like this:
const funcC = <Func extends FunctionA<infer I, infer O>>(input: I) => funcB<O, I>(input);
This would allow me to use it in the following way:
/** External Definition */
type A = FunctionA<string, number>;
/** External Definition */
funcC<A>('text');
Initially, I thought this would be straightforward, but I am struggling to find an effective approach.