-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
chore(types): more precise types for Events and added missing definitions #9675
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
Conversation
Thanks for this PR. Could you please resolve the conflicts? |
d350995
to
458624a
Compare
WalkthroughUpdated JSX event handler typings in Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@edison1105 done, thanks |
I just noticed that the |
458624a
to
55e6481
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/runtime-dom/src/jsx.ts (1)
1327-1331
: Form-event typings look good; moveonCancel
comment to “dialog events” and check TS baseline
- onInput: InputEvent and onFormdata: FormDataEvent are correct.
- onCancel is a dialog event (HTMLDialogElement); keeping it in the global Events map is fine, but move the comment header from “form events” to “dialog events” for clarity.
- lib.dom availability: FormDataEvent and SubmitEvent added in TypeScript 4.4; InputEvent changes landed around Dec 2021 and appear in TypeScript 4.5+. Ensure project minimum TypeScript/lib.dom >=4.5 if relying on InputEvent (>=4.4 for FormDataEvent/SubmitEvent).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/runtime-dom/src/jsx.ts
(3 hunks)
🔇 Additional comments (5)
packages/runtime-dom/src/jsx.ts (5)
1336-1339
: Add fullscreen events: LGTM.onFullscreenchange/onFullscreenerror as Event align with MDN.
1419-1419
: Add onAnimationcancel: LGTM.Correct type and name.
1424-1426
: Add Security Policy Violation event: LGTM.onSecuritypolicyviolation: SecurityPolicyViolationEvent matches MDN.
1428-1428
: Add transitioncancel/run: LGTM.Both are valid TransitionEvent entries.
Also applies to: 1431-1431
1411-1414
: Popover events: ToggleEvent requires TypeScript 5.5+ — confirm project TS or add fallbackToggleEvent was added to lib.dom in TypeScript 5.5 (seen in TS 5.5.3). If our minimum TS < 5.5, widen the props to Event or add a local conditional alias at packages/runtime-dom/src/jsx.ts (lines 1411–1414).
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
55e6481
to
8e7e9aa
Compare
Moved |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
I just want to say thank you for updating the typings! |
This pr fixes some imprecise Event definitions and adds some that were missing.
The list was compiled by consulting the list of events documented on MDN that are fired by
Element
or a subclass and where the event is not experimental.Personally, I was impacted more often by the wrong
onInput
andonSubmit
definitions.Some other notable changes are the
onClick
event being changed toPointerEvent
(which extendsMouseEvent
, so I don't see an issue here) andonScroll
, being the only downgrade, which was not documented as anUiEvent
on MDN, and I am not sure why it was defined as such here.Summary by CodeRabbit
New Features
Bug Fixes
Refactor