我有一个具有定义的属性类型的React组件库,考虑切换到Typescript。是否有任何工具可以帮助移植代码?这是一个简单组件的示例属性集:
static propTypes = {
active: PropTypes.bool,
children: PropTypes.node,
disabled: PropTypes.bool,
icon: Icon.propTypes.kind,
tabIndex: PropTypes.number
};
我正在想象一种工具,可以将它转换成类似于:
interface IButtonProps {
active: boolean,
children: node,
disabled: boolean,
icon: Icon,
tabIndex: number
}
写起来不太难,但如果它已经存在就更好了。