Skip to content

Type command event handlers as CommandEvent - #2573

Merged
github-actions[bot] merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-command-event-type
Oct 14, 2026
Merged

github-actions[bot] merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-command-event-type

Conversation

@rksharma-owg

@rksharma-owg RKS (rksharma-owg) commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Command-event listeners and oncommand handlers currently infer Event, so accessing the documented command and source properties fails to type-check.

WebRef already identifies the event as CommandEvent, but the generator looks up the inherited handler under GlobalEventHandlers and falls back to Event.

Map the event in inputfiles/patches/events.kdl, regenerate the four affected DOM baselines, and add a compiler fixture requiring CommandEvent inference for element/document/window/global listeners and element/window/global handlers. The event mapping uses the shared KDL event patch.

Closes #2554.

Validation: the strengthened fixture fails on the mapping-free baseline and passes with the KDL event patch. npm test and npx tsgo passed locally. Fork preflight passed all eight jobs for contribution commit 3229bab902b6d472aa7ad058cdc6c8cb479aa96d: baseline/patch/isolated-merge generator checks, both CodeQL languages, and downstream TypeScript tests. Against TypeScript 6c976dad5d65d2c67f5707f3ba4a04ae991b8481, baseline and patch each exited 0 with 166,611 tests reported and 2,143 skips, no failures, and no compiler-baseline changes.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR!

This section of the codebase is owned by Kagami Sascha Rosylight (@saschanaz) - if they write a comment saying "LGTM" then it will be merged.

Comment thread inputfiles/overridingTypes.jsonc Outdated
"event": [
{
"name": "command",
"type": "CommandEvent"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go to events.kdlinstead

@saschanaz

Copy link
Copy Markdown
Contributor

LGTM, thanks!

@github-actions
github-actions Bot merged commit 6843e1f into microsoft:main Oct 14, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Merging because Kagami Sascha Rosylight (@saschanaz) is a code-owner of all the changes - thanks!

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

Successfully merging this pull request may close these issues.

GlobalEventHandlersEventMap "command" mapped incorrectly

2 participants