I'm working on integrating the Google Maps API into my Angular project and ran into some issues. Here's what I did to install the necessary npm packages:
npm install @agm/core --save-dev
npm install @types/googlemaps --save-dev
Next, I added the following line to my component:
import {} from "@types/googlemaps";
However, when I checked in VS Code, I encountered the following errors:
[ts] File 'h:/Angular Projects/Breakfast/client/breakfast/node_modules/@types/googlemaps/index.d.ts' is not a module.
[ts] Cannot import type declaration files. Consider importing 'googlemaps' instead of '@types/googlemaps'.
To try and resolve this, I included the following lines in both tsconfig.json and tsconfig.spec.json:
"types": ["googlemaps"]
"moduleResolution": "node"
Unfortunately, the issue persisted. Upon inspecting Chrome Dev Tools, I came across the error:
Error: Uncaught (in promise): TypeError: Cannot read property 'Autocomplete' of undefined
TypeError: Cannot read property 'Autocomplete' of undefined
For context, I am using Angular version 6 and TypeScript Version 2.9.2. I also attempted the same steps with Angular 5, but encountered the same problem.