//输入:
type Fn = (a: number, b: string) => number;
type AppendArgument<Fn extends Function,X> = Fn extends (...args:infer P)=> infer R ? (...args:[...P,X])=> R:never
// 期望是 (a: number, b: string, x: boolean) => number
type Result = AppendArgument<Fn, boolean>;
typescript类型体操-追加参数
最新推荐文章于 2024-11-08 14:58:24 发布