Google Maps typings in Angular

Today I was working on integrating google maps in Angular, I found a critical part missing…TYPINGS! So here is a quick tutorial on how to add google maps typings.

  1. install googlemaps typings
npm install --save @types/googlemaps --save

Don’t forget you’ll have to add

/// <reference path="<relevant path>/node_modules/@types/googlemaps/index.d.ts" />

to the top of your .component.ts file to use the typing in Angular 6 or higher. For angular versions lower than 6 the following can be used:

import { } from '@types/googlemaps';

That’s it. You’ll now be able to use the google maps API typed!

More information can be found here :