小编use*_*948的帖子

Antd React Icon 组件中的类型错误

在我的 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 …

typescript reactjs antd

13
推荐指数
2
解决办法
6349
查看次数

标签 统计

antd ×1

reactjs ×1

typescript ×1