I try to create a function that takes a function as argument and returns a function with the same signature. This looks like this:
function create<TCreator extends (...args: any) => any>(creator: TCreator) {
return (...params: Parameters<TCreator>) => creator(params);
}
And I use it like this:
const created = create((a: string, b: string) => ({
a,
b
}));
When I look at the type of the created variable, the return type is any instead of { a: string, b: string}:
const created: (a: string, b: string) => any
Any idea how I could fix that?