@types/googlemaps/index.d.ts' is not a module
Thanks to this documentation link : https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
[Angular 6+] You only have to add this line at the beginning (meaning line 1, with nothing before) of your Typescript file :
/// <reference types="@types/googlemaps" />
[Angular 5-] You only have to add this line anywhere in your Typescript file imports :
import {} from "googlemaps";
Thanks to the answer below, you may also need to add a file <root>/index.d.ts
containing (didn't need it though in my case) :
declare module 'googlemaps';
The import can be simplified as follows:
import {} from "googlemaps";
Create a file at your projects root directory named index.d.ts
and paste the following:
declare module 'googlemaps';
The created file needs to be located directory in the src
folder
I found this article about what is the purpose of that file
In my Angular 7+ project
$ npm install @types/googlemaps --save-dev
In tsconfig.app.json
"types": [ "googlemaps"]
Thank you the link belowhttps://www.freakyjolly.com/angular-7-6-add-google-maps-in-angular-2-plus-applications-using-angular-google-maps-module-agm-core-easily/#more-2316