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

Some help with typescript #105

Closed
tamueller opened this issue Feb 28, 2020 · 3 comments
Closed

Some help with typescript #105

tamueller opened this issue Feb 28, 2020 · 3 comments
Assignees
Labels
Type: documentation Issue that highlights an imprecision in the documentation

Comments

@tamueller
Copy link

Hi,
I'm trying to get webmidi to work with typescript, but until now I've failed (I'm new to typescript, npm and packaging though). I installed webmidi using npm, but when I use:

import * as webmidi from "webmidi";
WebMidi.enable(function (err) {
  if (err) {
    console.log("WebMidi could not be enabled.", err);
  } else {
    console.log("WebMidi enabled!");
  }
});

I get an error that WebMidi is not defined, and when I try webmidi.enable it tells me that webmidi.enable is not a function. I tried different tools (gulp, parcel, webpackage) but can't find a solution.. does anyone have a simple working demo setup? Thanks for any help.

@djipco djipco self-assigned this Mar 4, 2020
@djipco
Copy link
Owner

djipco commented Mar 4, 2020

I am not a TypeScript user. However, there was some discussion that might help you in issue #82. Check it out and tell me if it helped.

@djipco djipco added the Status: info needed Info is needed before moving on label Mar 4, 2020
@djipco
Copy link
Owner

djipco commented Mar 11, 2020

@danigb has submitted a PR for the README.md file with more details on how to use WebMidi.js with TypeScript. I just merged it. Check out the TypeScript section. It should help you!

P.S. Given the above, I'm going to close the issue. If you still have trouble, feel free to reopen it.

@djipco djipco closed this as completed Mar 11, 2020
@djipco djipco added Type: documentation Issue that highlights an imprecision in the documentation and removed Status: info needed Info is needed before moving on labels Mar 11, 2020
@djipco
Copy link
Owner

djipco commented Aug 26, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: documentation Issue that highlights an imprecision in the documentation
Projects
None yet
Development

No branches or pull requests

2 participants