@@ -33,15 +33,6 @@ interface GoogleMapsWindow extends Window {
3333 google ?: typeof google ;
3434}
3535
36- // TODO(mbehrlich): Update this to use original map after updating DefinitelyTyped
37- /**
38- * Extends the Google Map interface due to the Definitely Typed implementation
39- * missing "getClickableIcons".
40- */
41- export interface UpdatedGoogleMap extends google . maps . Map {
42- getClickableIcons : ( ) => boolean ;
43- }
44-
4536/** default options set to the Googleplex */
4637export const DEFAULT_OPTIONS : google . maps . MapOptions = {
4738 center : { lat : 37.421995 , lng : - 122.084092 } ,
@@ -74,7 +65,13 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
7465 private readonly _zoom = new BehaviorSubject < number | undefined > ( undefined ) ;
7566 private readonly _destroy = new Subject < void > ( ) ;
7667 private _mapEl : HTMLElement ;
77- _googleMap : UpdatedGoogleMap ;
68+
69+ /**
70+ * The underlying google.maps.Map object
71+ *
72+ * See developers.google.com/maps/documentation/javascript/reference/map#Map
73+ */
74+ googleMap ?: google . maps . Map ;
7875
7976 /** Whether we're currently rendering inside a browser. */
8077 _isBrowser : boolean ;
@@ -257,8 +254,8 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
257254
258255 ngOnChanges ( ) {
259256 this . _setSize ( ) ;
260- if ( this . _googleMap && this . mapTypeId ) {
261- this . _googleMap . setMapTypeId ( this . mapTypeId ) ;
257+ if ( this . googleMap && this . mapTypeId ) {
258+ this . googleMap . setMapTypeId ( this . mapTypeId ) ;
262259 }
263260 }
264261
@@ -269,8 +266,8 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
269266 this . _setSize ( ) ;
270267 this . _googleMapChanges = this . _initializeMap ( this . _combineOptions ( ) ) ;
271268 this . _googleMapChanges . subscribe ( ( googleMap : google . maps . Map ) => {
272- this . _googleMap = googleMap as UpdatedGoogleMap ;
273- this . _eventManager . setTarget ( this . _googleMap ) ;
269+ this . googleMap = googleMap ;
270+ this . _eventManager . setTarget ( this . googleMap ) ;
274271 } ) ;
275272
276273 this . _watchForOptionsChanges ( ) ;
@@ -293,7 +290,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
293290 bounds : google . maps . LatLngBounds | google . maps . LatLngBoundsLiteral ,
294291 padding ?: number | google . maps . Padding ) {
295292 this . _assertInitialized ( ) ;
296- this . _googleMap . fitBounds ( bounds , padding ) ;
293+ this . googleMap ! . fitBounds ( bounds , padding ) ;
297294 }
298295
299296 /**
@@ -302,7 +299,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
302299 */
303300 panBy ( x : number , y : number ) {
304301 this . _assertInitialized ( ) ;
305- this . _googleMap . panBy ( x , y ) ;
302+ this . googleMap ! . panBy ( x , y ) ;
306303 }
307304
308305 /**
@@ -311,7 +308,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
311308 */
312309 panTo ( latLng : google . maps . LatLng | google . maps . LatLngLiteral ) {
313310 this . _assertInitialized ( ) ;
314- this . _googleMap . panTo ( latLng ) ;
311+ this . googleMap ! . panTo ( latLng ) ;
315312 }
316313
317314 /**
@@ -322,7 +319,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
322319 latLngBounds : google . maps . LatLngBounds | google . maps . LatLngBoundsLiteral ,
323320 padding ?: number | google . maps . Padding ) {
324321 this . _assertInitialized ( ) ;
325- this . _googleMap . panToBounds ( latLngBounds , padding ) ;
322+ this . googleMap ! . panToBounds ( latLngBounds , padding ) ;
326323 }
327324
328325 /**
@@ -331,7 +328,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
331328 */
332329 getBounds ( ) : google . maps . LatLngBounds | null {
333330 this . _assertInitialized ( ) ;
334- return this . _googleMap . getBounds ( ) || null ;
331+ return this . googleMap ! . getBounds ( ) || null ;
335332 }
336333
337334 /**
@@ -340,7 +337,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
340337 */
341338 getCenter ( ) : google . maps . LatLng {
342339 this . _assertInitialized ( ) ;
343- return this . _googleMap . getCenter ( ) ;
340+ return this . googleMap ! . getCenter ( ) ;
344341 }
345342
346343 /**
@@ -349,7 +346,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
349346 */
350347 getClickableIcons ( ) : boolean {
351348 this . _assertInitialized ( ) ;
352- return this . _googleMap . getClickableIcons ( ) ;
349+ return this . googleMap ! . getClickableIcons ( ) ;
353350 }
354351
355352 /**
@@ -358,7 +355,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
358355 */
359356 getHeading ( ) : number {
360357 this . _assertInitialized ( ) ;
361- return this . _googleMap . getHeading ( ) ;
358+ return this . googleMap ! . getHeading ( ) ;
362359 }
363360
364361 /**
@@ -367,7 +364,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
367364 */
368365 getMapTypeId ( ) : google . maps . MapTypeId | string {
369366 this . _assertInitialized ( ) ;
370- return this . _googleMap . getMapTypeId ( ) ;
367+ return this . googleMap ! . getMapTypeId ( ) ;
371368 }
372369
373370 /**
@@ -376,7 +373,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
376373 */
377374 getProjection ( ) : google . maps . Projection | null {
378375 this . _assertInitialized ( ) ;
379- return this . _googleMap . getProjection ( ) ;
376+ return this . googleMap ! . getProjection ( ) ;
380377 }
381378
382379 /**
@@ -385,7 +382,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
385382 */
386383 getStreetView ( ) : google . maps . StreetViewPanorama {
387384 this . _assertInitialized ( ) ;
388- return this . _googleMap . getStreetView ( ) ;
385+ return this . googleMap ! . getStreetView ( ) ;
389386 }
390387
391388 /**
@@ -394,7 +391,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
394391 */
395392 getTilt ( ) : number {
396393 this . _assertInitialized ( ) ;
397- return this . _googleMap . getTilt ( ) ;
394+ return this . googleMap ! . getTilt ( ) ;
398395 }
399396
400397 /**
@@ -403,7 +400,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
403400 */
404401 getZoom ( ) : number {
405402 this . _assertInitialized ( ) ;
406- return this . _googleMap . getZoom ( ) ;
403+ return this . googleMap ! . getZoom ( ) ;
407404 }
408405
409406 /**
@@ -412,7 +409,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
412409 */
413410 get controls ( ) : Array < google . maps . MVCArray < Node > > {
414411 this . _assertInitialized ( ) ;
415- return this . _googleMap . controls ;
412+ return this . googleMap ! . controls ;
416413 }
417414
418415 /**
@@ -421,7 +418,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
421418 */
422419 get data ( ) : google . maps . Data {
423420 this . _assertInitialized ( ) ;
424- return this . _googleMap . data ;
421+ return this . googleMap ! . data ;
425422 }
426423
427424 /**
@@ -430,7 +427,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
430427 */
431428 get mapTypes ( ) : google . maps . MapTypeRegistry {
432429 this . _assertInitialized ( ) ;
433- return this . _googleMap . mapTypes ;
430+ return this . googleMap ! . mapTypes ;
434431 }
435432
436433 /**
@@ -439,7 +436,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
439436 */
440437 get overlayMapTypes ( ) : google . maps . MVCArray < google . maps . MapType > {
441438 this . _assertInitialized ( ) ;
442- return this . _googleMap . overlayMapTypes ;
439+ return this . googleMap ! . overlayMapTypes ;
443440 }
444441
445442 private _setSize ( ) {
@@ -507,7 +504,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
507504
508505 /** Asserts that the map has been initialized. */
509506 private _assertInitialized ( ) {
510- if ( ! this . _googleMap ) {
507+ if ( ! this . googleMap ) {
511508 throw Error ( 'Cannot access Google Map information before the API has been initialized. ' +
512509 'Please wait for the API to load before trying to interact with it.' ) ;
513510 }
0 commit comments