Fixing the Vuetify import error in TypeScript
Environment
- OS: Windows10
- Vue.js: 2.5.21
- Vuetify: 1.3.14
- typescript: 3.2.2
- tslint: 5.11.0
Symptom
After selecting TypeScript in [vue-cli] to start a project, adding [Vuetify] and building results in the following error.
ERROR in C:/workspace/inhasite/general/ctlt_apply/english_clinic/src/plugins/vuetify.ts
2:21 Could not find a declaration file for module 'vuetify/lib'. 'C:/workspace/inhasite/general/ctlt_apply/english_clinic/node_modules/vuetify/lib/index.js' implicitly has an 'any' type.
Try `npm install @types/vuetify` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuetify/lib';`
1 | import Vue from 'vue';
> 2 | import Vuetify from 'vuetify/lib';
| ^
3 | import 'vuetify/src/stylus/app.styl';
4 |
5 | Vue.use(Vuetify, {
Version: typescript 3.2.2, tslint 5.11.0
Solution
Add the following option to the tsconfig.json file.
// tsconfig.json
"compilerOptions": {
"types": ["vuetify"],
Leave a comment