Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a type error in Antd React Icon component

In my React TypeScript project, I've upgraded antd components from version 5.1 to 5.5 and now seeing a compile-time error:

 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 |   );

It seems that in the new version of antd, the Icon component has a new required property called "rev". so now every place in my code I have to provide a value for this prop! I am curious why this happens in this specific project (other projects and of course antd samples don't have this issue) and if anyone faced it

    26 |     <div>
  > 27 |       <ReloadOutlined rev={undefined}/>
    28 |     </div>
like image 342
user2841948 Avatar asked Feb 03 '26 16:02

user2841948


2 Answers

update react type package to fix your issues

npm i -D @types/react@latest
npm i -D @types/react-dom@latest
like image 71
Amir Fahmideh Avatar answered Feb 05 '26 06:02

Amir Fahmideh


I have a same problem. When I upgrade the antd version 5.1.0 to 5.4.5. @ant-design/icon have "rev" props right now.

like image 33
a.eryilmaz Avatar answered Feb 05 '26 06:02

a.eryilmaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!