I'm trying to use the @types/googlemaps
type definition file.
The code looks like
declare namespace google.maps {
/***** Map *****/
export class Map extends MVCObject {
constructor(mapDiv: Element|null, opts?: MapOptions);
fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void;
...
...
overlayMapTypes: MVCArray<MapType>;
}
export interface MapOptions {
backgroundColor?: string;
disableDoubleClickZoom?: boolean;
draggable?: boolean;
...
When I try to use this type definition in my project, like so
import * as google from 'googlemaps';
I get a compile error saying
Error:(2, 25) TS2306:File 'C:/Users/CodyB/musicappproj/src/node_modules/@types/googlemaps/index.d.ts' is not a module.
Why does it not consider this types definition file to be a module? Am I using it wrong ? Is the definition file wrong?
google.maps.Map
.. if that doesnt work try puting/// <reference types="google" />
on top of your file – Suraj Rao