Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with AntDIconProps when using newer version of @types/react #47886

Closed
bombillazo opened this issue Mar 14, 2024 · 4 comments
Closed

Error with AntDIconProps when using newer version of @types/react #47886

bombillazo opened this issue Mar 14, 2024 · 4 comments
Assignees
Labels
🐛 Bug Ant Design Team had proved that this is a bug.

Comments

@bombillazo
Copy link
Contributor

bombillazo commented Mar 14, 2024

Steps to reproduce

When upgrading our @types/react package to 18.2.66, the AntD Icons give an error related to onPointerEnterCapture and onPointerLeaveCapture because they were removed.

What is expected?

AntD Icons are fixed so they don't try to pick those props in the AntDIconProps and IconProps.

What is actually happening?

From DefinitelyTyped/DefinitelyTyped#68984 onward, the onPointerEnterCapture and onPointerLeaveCapture props are removed, but they are being selected in all AntD Icon prop definitions.

The props need to be remove from

import * as React from 'react';
import { AntdIconProps } from '../components/AntdIcon';
declare const _default: React.ForwardRefExoticComponent<
  Pick<
    AntdIconProps, "start"  | ... | "onPointerLeaveCapture" | "onPointerEnterCapture" | ... 
  > & React.RefAttributes<HTMLSpanElement>
>;
export default _default;
Environment Info
antd 5.15.2
React 18.2.0
System N/A
Browser All
@zhu0629
Copy link

zhu0629 commented Mar 15, 2024

same issue

Run tsc
src/common/layout/components/AvatarMenu.tsx:18:14 - error TS2739: Type '{}' is missing the following properties from type 'Pick<AntdIconProps, "key" | "value" | "id" | "default" | "type" | "children" | "title" | "lang" | "className" | "href" | "download" | "hrefLang" | "media" | "target" | ... 349 more ... | "twoToneColor">': onPointerEnterCapture, onPointerLeaveCapture

18       icon: <UserSwitchOutlined />,
                ~~~~~~~~~~~~~~~~~~

@li-jia-nan
Copy link
Member

same problem

@li-jia-nan li-jia-nan added 🐛 Bug Ant Design Team had proved that this is a bug. and removed unconfirmed labels Mar 15, 2024
@sinna94
Copy link

sinna94 commented Mar 15, 2024

I temporarily resolved this by setting @types/react to version 18.2.65 until the issue was resolved.

@vagusX
Copy link
Member

vagusX commented Mar 15, 2024

Fixed in @ant-design/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants