const foo = (a: string, b: string) => {
console.log('foo', a, b);
};
const bar = (a: number, b: number) => {
console.log('bar', a, b);
};
const factory =
<M extends typeof foo | typeof bar>(method: M) =>
(...args: Parameters<M>) => {
method(...args);
};
I want to make multiple function’s factory (has different args)
But TypeScript throw an error below message.
A spread argument must either have a tuple type or be passed to a rest parameter.
Is Parameters
utillity type return tuple?