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

onPointerEnterCapture Errors #215

Closed
jd-carroll opened this issue Mar 15, 2024 · 5 comments
Closed

onPointerEnterCapture Errors #215

jd-carroll opened this issue Mar 15, 2024 · 5 comments

Comments

@jd-carroll
Copy link

I am getting errors from the IconType stating onPointerEnterCapture and onPointerLeaveCapture are missing. But when I try to add an empty handler I receive DOM errors:

app-index.js:33 Warning: Unknown event handler property `onPointerEnterCapture`. It will be ignored.
    at svg
    at SiX2 (webpack-internal:///(app-pages-browser)/../../node_modules/@icons-pack/react-simple-icons/icons/SiX.mjs:12:11)
    at button
    at eval (webpack-internal:///(app-pages-browser)/../../node_modules/@radix-ui/themes/dist/cjs/components/base-button.js:32:19)
    at eval (webpack-internal:///(app-pages-browser)/../../node_modules/@radix-ui/themes/dist/cjs/components/icon-button.js:32:22)

My default is to always assume I am doing something wrong... ?

But this is really weird, anyone seen this before?

@jd-carroll
Copy link
Author

Just did some additional investigating and I do not see either of those attributes defined in @types/react
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/2f4238e22773624585ec81994bf54ef9873f5e2c/types/react/ts5.0/index.d.ts#L2487-L2488

(which is why those types come up as untyped required attributes)

But how has no one else run into this issue?

@jd-carroll
Copy link
Author

Last thing, wouldn't it be better to structure IconType as:

type IconType = React.ForwardRefExoticComponent<
  Omit<React.SVGProps<SVGSVGElement>, 'title' | 'color' | 'size'> & {
    title?: string;
    color?: string;
    size?: string | number;
  } & React.RefAttributes<SVGSVGElement>
>;

@sfyr111
Copy link
Contributor

sfyr111 commented Mar 15, 2024

Hello everyone,

I've submitted a PR #216 that aims to resolve the type error issue highlighted in issue #215 by removing the onPointerEnterCapture and onPointerLeaveCapture from the type declarations, syncing with the recent updates to React's type definitions. I would greatly appreciate any feedback or suggestions on this solution.

Thank you for your time and looking forward to any further discussion!

@cschroeter
Copy link

This is only an issue for "@types/react": "18.2.67"

For a workaround you can downgrade to 18.2.62 - if only React would have been written in TypeScript...

@wootsbot
Copy link
Member

solved #216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants