I have a generic function type. I need to convert this type into another, with one more argument prepended to the function:
type FuncType = <T extends any>(arg: T): T;
type FuncWithPrependedArg: ...?
This type should look like this:
type FuncWithPrependedArg = <T extends any>(prepndedArg: any, arg: T): T;
How to derive the second type from the first one dynamically?
I need it because I have an obiect containing different functions and need to create a mapped type for all these functions:
const funcs = {
funcA: (arg: string): number => {/** ... */},
funcB: (): string => {/** ... */},
funcC: <T extends string>(arg: T): T => {/** ... */},
// ...etc
}
type Funcs: typeof funcs;
type MappedFuncs = SomeTypeToMap<Funcs>;
type SomeTypeToMap = ...?
Is it even possible?