Closed michaelcaterisano closed 3 years ago
Unfortunately, I am not a TypeScript user and know very little about it. For that reason, WebMidi.js does not officially support TypeScript yet. I am looking to change that for version 3 but will need a knowledgeable TypeScript dev to work on the type definitions.
At one point, users have reported that it was working (as you saw in issue #82) . I'm not sure why it isn't working for you.
For personal bandwidth reasons, official TypeScript support will not come before version 3 (unless someone chimes in to help).
Thanks @djipco. I did get the following syntax to work, which I found in the Tone.js/ui library:
const WebMidi: import("webmidi").WebMidi = require("webmidi");
A little funky, but it works!
@michaelcaterisano Thank you so much for taking the time to report back. It will probably be helpful to others. I added your technique to the README.
I tentatively added a types
directory with d.ts
files for all current classes (this is what the TypeScript compiler outputted). Is the usual practice to have a single index.d.ts
file? In any case, if you want to give it go, be my guest!
By the way, this is in the develop branch for v3.
Trying to interface a simple SPA application to my Fishman TriplePlay Controller. Using v.2.5.2 I'm able to read the played notes, I'm having some trouble with sysex management. 1) is the WebMidi.enable(...,true) necessary only once, or should it be issued (without 'true' parameter) again after sending the data initialisation array, when adding the event listeners?
2) Fishman doesn't provide support about sysex messages, and I'm trying to intercept the midi data with a MIDI monitor, but I'm unable to let it work. In particular I have to switch the controller from poly to mono mode (1 channel per guitar string), but it works only after I launch the proprietary sw, so I think I'm doing something wrong... Can someone post a complete example of a sysex communication?
@edellaq Since your question is not related to this thread, would you mind opening a new thread or, better yet, post it on the forum?
oops, sorry, will do. (I clicked on the link in the email notification, didn't notice the wrong thread)
I'm trying out webmidi 2.5.2 in a typescript environment and am getting an error when importing webmidi like this:
import Webmidi from "webmidi";
.I also tried
import * as WebMidi from "webmidi"
, but then I get the following error: