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

Export TS interfaces so they can be used for compile-time type checking #54

Closed
rain-sk opened this issue Jan 17, 2019 · 4 comments
Closed
Labels
Type: enhancement Request for improvement

Comments

@rain-sk
Copy link
Contributor

rain-sk commented Jan 17, 2019

Hello, lovely library! Thanks for all the work on this.

I'm working on a general timing library for Web Audio / Web MIDI applications, and would like to have intellisense and type checking for Interfaces that make up the webmidi package.

As an example, I can say const input = webmidi.inputs[0]. TypeScript indicates that input is of type Input, but I cannot write functions which accept the Input type as a parameter, and have to either manually copy the webmidi.d.ts to my source directory, or use the any type annotation.

I'm happy to submit a pull request if this is not a current priority!

@djipco
Copy link
Owner

djipco commented Jan 17, 2019

I do not use TypeScript, so I'm not too familiar with it. If you submit a PR, I will happily merge it. The original webmidi.d.ts file has been graciously contributed by @mmmveggies

@djipco djipco added the Type: enhancement Request for improvement label Jan 17, 2019
@rain-sk
Copy link
Contributor Author

rain-sk commented Jan 18, 2019

See: #55

@djipco
Copy link
Owner

djipco commented Jan 21, 2019

PR #55 has been merged to address this. Thank you!

@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: enhancement Request for improvement
Projects
None yet
Development

No branches or pull requests

2 participants