I am trying to build an Angular2 project, using the Web Midi API.
When runningng build, I am not able to complete the process due to certain errors thrown, specifically:
Error in bail mode: [default] /Users/JmsToh/GitHub/web-editor/web-editor/src/app/midi.service.ts:43:22 Property 'requestMIDIAccess' does not exist on type 'Navigator'.
This comes from this part of the code:
if (navigator.requestMIDIAccess) {
this.browserMidiCompatible = true;
navigator.requestMIDIAccess({ sysex: false })
.then(this.onMIDISuccess.bind(this), this.onMIDIReject.bind(this));
} else {
alert("Platform not compatible");
}
The app runs fine on Chrome when running ng serve.Is there any way to get Angular2 to ignore the error when building?
Add the necessary type definitions using:
npm install @types/webmidi
They should be automatically discovered after restarting tsc.
note: If after installing the library you see errors "Cannot find name
Map", see this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With