Closed sjxg closed 2 years ago
如果不修改,则 type Param 代码的运行结果不正确,因为 infer P 指代的是参数数组 [User]:
type Param
infer P
type ParamType<T> = T extends (...args: infer P) => any ? P : T; type Func = (user: User) => void; type Param = ParamType<Func>; // type Param = [user: User] 而不是 type Param = User
如果不修改,则
type Param
代码的运行结果不正确,因为infer P
指代的是参数数组 [User]: