Skip to content

Event type of midiInput.onmidimessage wrong #1571

@h-a-n-n-e-s

Description

@h-a-n-n-e-s

This

midiInput.onmidimessage = handleMIDIMessage;
with
handleMIDIMessage = (event:MIDIMessageEvent) => {...}

runs perfectly fine in the browser, but the TypeScript compiler throws this error:

Type '(event: MIDIMessageEvent) => void' is not assignable to type '(this: MIDIInput, ev: Event) => any'.
Types of parameters 'event' and 'ev' are incompatible.
Property 'data' is missing in type 'Event' but required in type 'MIDIMessageEvent'.

Shouldn't midiInput.onmidimessage have the type (this: MIDIInput, ev: MIDIMessageEvent) => any instead of (this: MIDIInput, ev: Event) => any ?

According to this
https://developer.mozilla.org/en-US/docs/Web/API/MIDIMessageEvent
it should.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions