在我的 React TypeScript 项目中,我已将 antd 组件从版本 5.1 升级到 5.5,现在看到编译时错误:
Property 'rev' is missing in type '{}' but required in type 'Pick<AntdIconProps, "value" | "onChange" | "color" | "content" | "height" | "rotate" | "translate" | "width" | "start" | "hidden" | "cite" | "data" | "form" |
"label" | ... 349 more ... | "twoToneColor">'.
25 | return (
26 | <div>
> 27 | <ReloadOutlined />
| ^^^^^^^^^^^^^^
28 | </div>
29 | );
Run Code Online (Sandbox Code Playgroud)
看来在新版本的 antd 中,Icon 组件多了一个新的必需属性,叫做“rev”。所以现在我代码中的每个地方都必须为这个道具提供一个值!我很好奇为什么会在这个特定项目中发生这种情况(其他项目当然还有 antd …