Closed
Description
I would like to create new tuple of function params A and B.. that means flatten together two function params. I have the flatten type for that. For sake of simplicity showing only with one Parameters not two below.
But problem is that Typescript then forgets the parameter names, would it be possible to fix it somehow? Neither is possible to extract the params names from Parameters<> helper. (just saying another not related problem)
type Flatten<T extends E[], E extends any[] = any[]> = {
[K in keyof T]: T[K][Exclude<keyof T[K], keyof any[]>]
}
const a = (x: string) => { }
const c = (...args: Parameters<typeof a>) { }
const d = (...args: Flatten<[Parameters<typeof a>]) { } // later here can be Flatten<[Tuple1, Tuple2]> only one for now.
c() // arguments are: x:string
d() // argumentes are: args_0:string
Best would be something like this
const e = (...args: [...Parameters<typeof a>]) { }