参考 element plus,很巧妙地使用动态类型定义,同时使用 ExtractPropTypes
得到静态类型。
packages/components/radio/src/radio.ts
:
// buildProps 的实现比较复杂,可以直接拿来使用就行了,就是对类型做了优化,有了静态类型类似 `PropType<string>`
export const radioPropsBase = buildProps({
size: useSizeProp,
disabled: Boolean,
label: {