问题描述
我正在使用styled-system
在我们的应用程序中使用react
设计样式,该应用程序的类型为@ types / styled-system here。
在渲染react
组件时,我发现react
和styled-system
都具有自己的属性color
的打字稿类型实现,这在我所使用的应用程序中引起冲突建造。我正在尝试以这种方式覆盖color
类型中的react
属性。
declare module "react" {
interface CustomHTMLAttributes extends Omit<HTMLAttributes<T>,'color'>{}
interface HTMLAttributes extends CustomHTMLAttributes {
color?: 'red' | 'blue' | 'green';
}
}
以上实现不正确。但是为了给我一个我想要达到的目标的想法,我附上了代码示例。
如何在应用程序color
库内的HTMLAttribute
接口中覆盖react
属性
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)