Angular-google-maps: Cannot file module 'google

Created on 3 Jul 2016  路  5Comments  路  Source: SebastianM/angular-google-maps

Issue description
Hi :)

Im using this library with google places api.
So I lazy load the js file:

this.places = new google.maps.places.Autocomplete(el.nativeElement.children[0], {
        types: ['(cities)'],
        componentRestrictions: { country: 'fr' }
      });

The problem is that the typescript compiler is telling me Cannot find name 'google'
since it loads dynamically I guess i cannot use the /// <reference path="???" />

Any ideas?

Most helpful comment

Not working for me, Any snippet would be grate?

All 5 comments

After your imports or as a private class member define

declare var google: any;

@brian-singer Thanks! looking good :)

Not working for me, Any snippet would be grate?

A bit late to the party, but in case someone ends up on this page...
This worked for me:

npm install @types/googlemaps --save

Then in the component where I use the google name:

import { } from '@types/googlemaps';

I hope it helps.

Hello.
I've got next error message after added import { } from '@types/googlemaps': error TS6137: Cannot import type declaration files.
declare var google: any; not working for me.
In tsconfig after yarn add -D @types/googlemaps "types": ["googlemaps"] not working too.
Anybody know another hacks?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n1t3w0lf picture n1t3w0lf  路  3Comments

marcelinobadin picture marcelinobadin  路  3Comments

PeterSisovsky picture PeterSisovsky  路  3Comments

matishw picture matishw  路  3Comments

DeveloperAdd007 picture DeveloperAdd007  路  3Comments