Parameters
提取函数参数的类型:
1type T3 = Parameters<typeof f1>;2
3type T3 = [arg: {4 a: number;5 b: string;6}]
碰到的使用场景是在 [[Astro]] 中导入时,希望同样也支持导入方法的部分 Props:
1type SimpleCardProps = Parameters<typeof SimpleCard>[0];2
3interface Props {4 size?: Pick<SimpleCardProps, 'size'>['size'];5 className?: string;6}