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

Types for synthetic events using compat? #4510

Closed
jose-torres-marin opened this issue Sep 26, 2024 · 2 comments · Fixed by #4512
Closed

Types for synthetic events using compat? #4510

jose-torres-marin opened this issue Sep 26, 2024 · 2 comments · Fixed by #4512

Comments

@jose-torres-marin
Copy link
Contributor

Aliasing react and react-dom to preact/compat and then doing:
import { MouseEvent } from 'react'

Typescript complains:
Namespace 'React' has no exported member 'MouseEvent'.ts(2694)

I can see MouseEvent doesn't exist in the index file.

Could anyone clarify the proper way to type a mouse event using preact/compat?

@jose-torres-marin
Copy link
Contributor Author

Using import { JSX } from "preact" and then JSX.TargetedMouseEvent

@rschristian
Copy link
Member

I think we can & should re-export these from compat so that this works. As such, going to reopen.

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

Successfully merging a pull request may close this issue.

2 participants