跳到主要内容

用在 react 中的一点类型。

源码参看bug 🙋‍♂️ 提交

简单的浏览器方法。

安装​

npm install @vvi/type-react --save

可用的类型​

  • SimpleObject - 简单对象
  • HTMLTagName - 基础 HTML 元素标签名(含 SVG )
  • ElementTypeFromTagName - 从元素标签获取元素的类型
  • TagNameToProps - 从元素标签名获取该元素的 Props (不含 ref )
  • WithRefForTagName - 从元素标签名获取该元素的 Props (含 ref )
  • MayWithRef - 可能携带 ref 属性
  • JSXOtherAttribute - 其他可配置的属性
  • AsProp - 作为元素使用( style-component 构建的 JSX 携带该属性 )
  • PropsWithTagName - 简单的属性包装器
  • PropsWithTagNameCustomRef - 含自定义 ref 的属性(元素标签)
  • JSXComponent - 构建带类型声明的组件 (元素标签)
  • JSXComponentNoProps - 无自定义属性类型(元素标签),等同于 JSXComponent<{}, TagName>
  • MergeProps - 合并属性
  • PolymorphicComponent - 多态组件