function fun1(a:number, b:string, c:()=>void)
{
}
function fun2(...args:Parameters<typeof fun1>)
{
}
I want exclude a specific index of fun1‘s parameters from function fun2‘s parameter types.
Basically the result should be:
function fun2(b:string, c:()=>void)
{
}
I tried using Omit<Parameters<typeof this._call>, "0"> but it doesn’t work.
>Solution :
You can declare a Tail type that drops the first element:
type Tail<T extends readonly unknown[]> =
T extends [unknown, ...infer Rest] ? Rest : never
and use it like this:
function fun2(...args: Tail<Parameters<typeof fun1>>) {}
// function fun2(b: string, c: () => void): void