14. 实现 Parameters
简单
实现 TypeScript 内置的工具类型 Parameters<T>
,但不可以使用它。可参考 TypeScript 官方文档了解其用法。
例如:
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<typeof foo> // expected [arg1: string, arg2: number]
实现 TypeScript 内置的工具类型 Parameters<T>
,但不可以使用它。可参考 TypeScript 官方文档了解其用法。
例如:
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<typeof foo> // expected [arg1: string, arg2: number]
TypeScript