I am looking to alter a function by changing its return type. While I came across this method on TypeScript: How to wrap a function, changing its return type?, I am seeking a more versatile solution.
type Test = (
a: string,
b: string,
c: number,
) => string | Promise<string>;
type Test2 = (
a: string,
b: string,
c: number,
) => number | Promise<number>;
My desired outcome would be something like:
// CopyFunction(Function, Return)
type Test2 = CopyFunction(Test, number | Promise<number>);