Skip to content

Fix MIDIMessageEvent.data incorrectly typed as nullable - #64341

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-midi-message-event-data-type
Draft

Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-midi-message-event-data-type

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

MIDIMessageEvent.data was typed as Uint8Array | null, forcing unnecessary null checks (TS18047) under --strict. Per the Web MIDI spec, data is always a non-null Uint8Array.

Changes

  • Updated MIDIMessageEvent.data in tsc/internal/bundled/libs/lib.dom.d.ts to Uint8Array<ArrayBuffer> (removed the | null union)
  • Applied the same fix to the mirrored test fixture tsc/testdata/fixtures/lib/dom.generated.d.ts
  • Added compiler test midiMessageEventDataNotNullable.ts verifying event.data[0] no longer errors under --strict in a midimessage handler
input.onmidimessage = (event) => {
    event.data[0]; // no longer errors: Object is possibly 'null'
};

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 19, 2026
Copilot AI changed the title [WIP] Fix MIDIMessageEvent data type to be always Uint8Array Fix MIDIMessageEvent.data incorrectly typed as nullable Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MIDIMessageEvent data is incorrectly typed

2 participants