Search code examples
typescriptvuejs2typescript-typingsvue-cli

Could not find a declaration file for third party modules - how to declare and resolve these errors


I am working on a project with typescript (generated with vue cli 3.0).

When I import third party modules, I get errors such as:

Could not find a declaration file for module 'vue-slider-component'. 
'/home/wahid/Development/tealvalley-app/node_modules/vue-slider- 
component/dist/index.js' implicitly has an 'any' type.

What is the correct way to resolve these kind of issues? The types are not defined in the @types package, so if I were to define them myself, where do I keep it?


Solution

  • What is the correct way to resolve these kind of issues?

    Create a file vendor.d.ts that has:

    declare module 'vue-slider-component';