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

WebMIDI #1724

Open
sy-filis opened this issue May 13, 2024 · 1 comment
Open

WebMIDI #1724

sy-filis opened this issue May 13, 2024 · 1 comment

Comments

@sy-filis
Copy link

sy-filis commented May 13, 2024

Hi there,

Could someone please address an issue with the WebMIDI API types lib.dom.d.ts:14856-15024?

I believe that MIDIInputMap should extend ReadOnlyMap<MIDIInput["id"], MIDIInput> (MDN) and that the forEach method could be removed as part of ReadOnlyMap interface (es2015.iterable.d.ts:119, es2015.collection.d.ts:37). The same situation applies to MIDIOutputMap (MDN).

The second issue concerns constructors for MIDIAccess, MIDIInputMap, MIDIOutputMap, MIDIPort, MIDIInput and MIDIOutput. When attempting to instantiate any of these, I encounter an Uncaught TypeError: Illegal constructor error, although TypeScript indicates it should be permissible.

Thank you.

@saschanaz
Copy link
Contributor

saschanaz commented Jun 25, 2024

The reason it's done with forEach is because es5 doesn't support Map. For target: ES2015+ you should automatically get ReadonlyMap:

interface MIDIInputMap extends ReadonlyMap<string, MIDIInput> {
}

Or you can give "lib": ["dom", "dom.iterable"].

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

No branches or pull requests

2 participants