type SomeFunc = (a:string, b:number, c:someCustomType) => number;
I want to create a type that is just like the one above, except there is a single parameter added at the end. Let's say, d:number;
type SomeFuncAltered = (a:string, b:number, c:someCustomType, d:number) => number;
I do not want to craft the entire type manually though, I'm pretty sure there's a smart trick with Parameters<func> to be used here.
type Alter<T extends (...args: any) => any> = (extraArg: number, ...args: Parameters<T>) => ReturnType<T>;. I don't know how to add it at the end though, since rest args can only be at the end.