magenta / magenta-js

Magenta.js: Music and Art Generation with Machine Learning in the browser
https://magenta.tensorflow.org
Apache License 2.0
1.98k stars 313 forks source link

Cannot find namespace 'WebMidi'. #216

Closed Gaturae closed 5 years ago

Gaturae commented 5 years ago

When I start my ng-project, I got a error like this node_modules/@magenta/music/es5/core/recorder.d.ts(30,22): error TS2503: Cannot find namespace 'WebMidi'. what`s wrong with my ng-project ,my ng-version is 6.0

notwaldorf commented 5 years ago

Hmm, why are you using the ts files directly? I think you should be using the built library, from dist instead

adarob commented 5 years ago

Closing this out due to lack of response. Please reopen if needed!

maxn0d3x commented 5 years ago

Hmm, why are you using the ts files directly? I think you should be using the built library, from dist instead

@notwaldorf I just installed the latest magentamusic npm package for my Angular project. I've got same error; I don't use the ts files directly. In Angular typescript project, I cannot use magentamusic.js script javascript file because Angular needs Typescript and d.ts type file.

ERROR in node_modules/@magenta/music/es5/core/player.d.ts(51,14): error TS2503: Cannot find namespace 'WebMidi'. node_modules/@magenta/music/es5/core/player.d.ts(52,32): error TS2503: Cannot find namespace 'WebMidi'. node_modules/@magenta/music/es5/core/recorder.d.ts(34,22): error TS2503: Cannot find namespace 'WebMidi'. node_modules/@magenta/music/es5/core/recorder.d.ts(35,24): error TS2503: Cannot find namespace 'WebMidi'. node_modules/@magenta/music/es5/core/recorder.d.ts(39,32): error TS2503: Cannot find namespace 'WebMidi'.

Even though magentajs music core sources are written in Typescript having d.ts, the output files built doesn't look up d.ts correctly. IDK . Maybe WebMidi package hasn't been installed after installing npm @magenta/music package.

I think Angular cannot find the package installed.

Please check out the how magentajs music package exports webmidi and types in the package.json of @magenta/music!

loganstillings commented 5 years ago

I'm having the same issue and I think this should be reopened

notwaldorf commented 5 years ago

This is a duplicate of https://github.com/tensorflow/magenta-js/issues/278, which is still open (i don't think we need 2 issues with the same content. I've already triaged that one, so going to re-close this one (but please follow #278 for comments)