【文件属性】:
文件名称:babel-plugin-typescript-to-proptypes:从TypeScript界面生成React PropTypes或键入别名
文件大小:202KB
文件格式:ZIP
更新时间:2021-02-06 05:18:09
react typescript babel-plugin prop-types TypeScriptTypeScript
babel-plugin-typescript-proppropys
一个Babel插件,用于从TypeScript接口或类型别名生成React PropType。
如果未启用typeCheck选项,则不支持转换外部类型引用(因为Babel没有类型信息)。
例子
支持定义通用道具的类组件。
// Before
import React from 'react' ;
interface Props {
name ?: string ;
}
class Example extends React . Component < Props> {
render ( ) {
ret