Could not find a declaration file for module 'vuejs-datepicker'.

Error Details:

ERROR in path
17:24 Could not find a declaration file for module 'vuejs-datepicker'.
'C:/.../node_modules/vuejs-datepicker/dist/vuejs-datepicker.js' implicitly has an 'any' type.
  Try `npm install @types/vuejs-datepicker` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuejs-datepicker';`


Scenario :

Integrated vuejs-datepicker to your cue- cli, Vue with typescript project.

https://www.npmjs.com/package/vuejs-datepicker

you might be observing a type error like could not find a declaration file for module 'vuejs-datepicker'

So if you try to add the types from pm, it won't be able to find the same hence you will be getting the below error.
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fvuejs-datepicker - Not found
npm ERR! 404
npm ERR! 404  '@types/vuejs-datepicker@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
So the solution to the problem is you can add a declaration file, it can be any name eg.
declarations.d.ts in the root of your src folder and the below line of code.

declare module 'vuejs-datepicker';

0 comments: