Search code examples
javascriptwebpackvuejs2vue-clivue2-google-maps

Can't import vue2-google-maps component to main.js


After installing vue2-google-maps with npm, I'm trying to import the component to my main.js. But I keep getting an error. I never had problem importing packages to main.js or to other .vue files.

Versions: vue 2.6.10 vue2-google-maps@0.10.7 vue-cli 2.9.6 but also tried with 3.11.0

import App from "./App.vue";
import store from "./store/store.js";
import * as VueGoogleMaps from "vue2-google-maps";

Vue.use(
  VueGoogleMaps,
  {
    load: {
      key: "AIzaSyBYULuuIqKYMJVrEk1PjpUDQQYkGMmP0iM",
      libraries: 'places'
    }
  }
);


I'm getting the error in this line : import * as VueGoogleMaps from "vue2-google-maps";

Error Message: Could not find a declaration file for module 'vue2-google-maps'. 'c:/Users/BotiVegh/vueJS_projects/vue-store-gallery-map/node_modules/vue2-google-maps/dist/main.js' implicitly has an 'any' type. Try npm install @types/vue2-google-maps if it exists or add a new declaration (.d.ts) file containing declare module 'vue2-google-maps';ts(7016)

Do I need to change something in the config file?


Solution

  • You could try adding "noImplicitAny": false to your tsconfig.json file

    This disables warnings on expressions and declarations with an implied 'any' type