Coder Social home page Coder Social logo

Comments (5)

tambien avatar tambien commented on August 23, 2024

i think the trick here has to do with tsconfig. I wrote up a .d.ts for midi-file, but it doesn't seem to always be included in the builds. Didn't work path relative, so maybe it's got to be linked in another way.

from midi.

motifn avatar motifn commented on August 23, 2024

FWIW the only way I could get this to work was to copy the latest midi-file.d.ts into the app that references Tonejs/midi. A reasonable stop-gap solution until we figure out how to link it properly (or until official type definitions for midi-file are published).

from midi.

stale avatar stale commented on August 23, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from midi.

stephaneeybert avatar stephaneeybert commented on August 23, 2024

I get the same error message:

ERROR in node_modules/@tonejs/midi/dist/Header.d.ts:1:26 - error TS7016: Could not find a declaration file for module 'midi-file'. '/home/stephane/dev/js/projects/angular/musicng/node_modules/midi-file/index.js' implicitly has an 'any' type.
  Try `npm install @types/midi-file` if it exists or add a new declaration (.d.ts) file containing `declare module 'midi-file';`                                                                                                                          

1 import { MidiData } from "midi-file";

I'm on an Angular 9 app having installed the dependency like:

npm install midi-file

My package.json file contains the dependencies:

"midi": "^1.0.0",
"midi-file": "^1.1.2",
"midi-file-slicer": "^5.0.45",
"midi-json-parser": "^6.4.19",
"web-midi-api": "^2.0.7",
"@tonejs/midi": "^2.0.20",
"@tonejs/ui": "0.0.9",

I cannot see any type definition file in my dependency:

$ tree node_modules/midi-file
node_modules/midi-file
├── index.js
├── lib
│   ├── midi-parser.js
│   └── midi-writer.js
├── package.json
└── README.md
1 directory, 5 files

from midi.

stephaneeybert avatar stephaneeybert commented on August 23, 2024

After I copied the content of the https://raw.githubusercontent.com/Tonejs/Midi/master/src/midi-file.d.ts file into a file in my app typings directory, as in:

$ tree typings/
typings/
├── midi-file
│   └── index.d.ts
├── nexusui
│   └── index.d.ts
└── tone
    └── index.d.ts

the issue was gone.

from midi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.