Could not find a declaration file for module 'vuelidate'

Viewed 2221

In Vuejs, while following the Vuelidate installation instructions (https://vuelidate.js.org/#getting-started), I get a warning at:

import Vuelidate from 'vuelidate'

The warning says:

Could not find a declaration file for module 'vuelidate'. 'c:/Users/[myUser]/../../index.js' implicitly has an 'any' type. Try npm install @types/vuelidate if it exists or add a new declaration (.d.ts) file containing declare module 'vuelidate';ts(7016)

1 Answers

it appears you are using typescript, and thus Vue requires a type declaration file for all Vuelidate methods and properties. If you run npm install @types/vuelidate as suggested, the error should go away.

In the future, if you are working with an npm module that has not published types through npm, you will have to write the declaration file yourself, but don't worry about it for now.

Related