rcarcasses / vue-cytoscape

cytoscape.js now inside vue.js
https://rcarcasses.github.io/vue-cytoscape
MIT License
96 stars 34 forks source link

How to use this with Typescript? #38

Closed tomphp closed 5 years ago

tomphp commented 5 years ago

Hi, we're trying to use this library in a Typescript project and we're getting the following error:

TS7016: Could not find a declaration file for module 'vue-cytoscape'. '/project/path/node_modules/vue-cytoscape/dist/vue-cytoscape.common.js' implicitly has an 'any' type.

I'm pretty new to Typescript and haven't tried creating declaration files before, but I think that's what needs to be done here? Before we embark on trying to learn how to do this, do you have an example of one?

Thanks!

rcarcasses commented 5 years ago

Hey @tomphp, thanks for pointing this out: types were not being published in version 1.0.4, I have added them in version 1.0.5, can you give a try and let me know?

tomphp commented 5 years ago

@rcarcasses thanks for such a quick response. I've updated to 1.0.5 and still getting the same error. node_modules/vue-cytoscape looks like this (assuming that there should be a .d.ts file in there?):

vue-cytoscape
├── LICENSE
├── README.md
├── dist
│   ├── demo.html
│   ├── vue-cytoscape.common.js
│   ├── vue-cytoscape.common.js.map
│   ├── vue-cytoscape.umd.js
│   ├── vue-cytoscape.umd.js.map
│   ├── vue-cytoscape.umd.min.js
│   └── vue-cytoscape.umd.min.js.map
└── package.json
rcarcasses commented 5 years ago

yes, there should be a dist/src/plugin.d.ts right there, I'll check later during the day as soon as I have a chance.

tomphp commented 5 years ago

@rcarcasses awesome, thank you for looking into this so quickly!

rcarcasses commented 5 years ago

Hey @tomphp, fix is now done, example at:

https://github.com/rcarcasses/vue-cytoscape-1.x.x-test

Thanks for contributing with vue-cytoscape!