Skip to content

Commit ca71879

Browse files
committed
fix(google-maps): update to latest typings and remove manual override
Bumps us to the latest version of the Google Maps typings and removes a workaround that was in place due to the old ones being incomplete.
1 parent e0b5797 commit ca71879

File tree

12 files changed

+24
-35
lines changed

12 files changed

+24
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@angular/elements": "^9.1.0",
5555
"@angular/forms": "^9.1.0",
5656
"@angular/platform-browser": "^9.1.0",
57-
"@types/googlemaps": "^3.37.0",
57+
"@types/googlemaps": "^3.39.3",
5858
"@types/youtube": "^0.0.38",
5959
"@webcomponents/custom-elements": "^1.1.0",
6060
"core-js": "^2.6.9",

src/google-maps/google-map/google-map.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {
1212
DEFAULT_HEIGHT,
1313
DEFAULT_OPTIONS,
1414
DEFAULT_WIDTH,
15-
GoogleMap,
16-
UpdatedGoogleMap
15+
GoogleMap
1716
} from './google-map';
1817

1918
/** Represents boundaries of a map to be used in tests. */
@@ -32,7 +31,7 @@ const testPosition: google.maps.LatLngLiteral = {
3231

3332
describe('GoogleMap', () => {
3433
let mapConstructorSpy: jasmine.Spy;
35-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
34+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
3635

3736
beforeEach(async(() => {
3837
TestBed.configureTestingModule({

src/google-maps/google-map/google-map.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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 */
4637
export const DEFAULT_OPTIONS: google.maps.MapOptions = {
4738
center: {lat: 37.421995, lng: -122.084092},
@@ -75,7 +66,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
7566
private readonly _zoom = new BehaviorSubject<number|undefined>(undefined);
7667
private readonly _destroy = new Subject<void>();
7768
private _mapEl: HTMLElement;
78-
_googleMap: UpdatedGoogleMap;
69+
_googleMap: google.maps.Map;
7970

8071
/** Whether we're currently rendering inside a browser. */
8172
_isBrowser: boolean;
@@ -270,7 +261,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
270261
this._setSize();
271262
this._googleMapChanges = this._initializeMap(this._combineOptions());
272263
this._googleMapChanges.subscribe((googleMap: google.maps.Map) => {
273-
this._googleMap = googleMap as UpdatedGoogleMap;
264+
this._googleMap = googleMap;
274265
this._eventManager.setTarget(this._googleMap);
275266
});
276267

src/google-maps/map-circle/map-circle.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {GoogleMapsModule} from '../google-maps-module';
77
import {
88
createCircleConstructorSpy,
@@ -15,7 +15,7 @@ import {
1515
import {MapCircle} from './map-circle';
1616

1717
describe('MapCircle', () => {
18-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
18+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
1919
let circleCenter: google.maps.LatLngLiteral;
2020
let circleRadius: number;
2121
let circleOptions: google.maps.CircleOptions;

src/google-maps/map-info-window/map-info-window.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {MapMarker} from '../map-marker/map-marker';
77
import {
88
createInfoWindowConstructorSpy,
@@ -16,7 +16,7 @@ import {GoogleMapsModule} from '../google-maps-module';
1616
import {MapInfoWindow} from './map-info-window';
1717

1818
describe('MapInfoWindow', () => {
19-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
19+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
2020

2121
beforeEach(async(() => {
2222
TestBed.configureTestingModule({

src/google-maps/map-marker/map-marker.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {
77
createMapConstructorSpy,
88
createMapSpy,
@@ -15,7 +15,7 @@ import {GoogleMapsModule} from '../google-maps-module';
1515
import {DEFAULT_MARKER_OPTIONS, MapMarker} from './map-marker';
1616

1717
describe('MapMarker', () => {
18-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
18+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
1919

2020
beforeEach(async(() => {
2121
TestBed.configureTestingModule({

src/google-maps/map-polygon/map-polygon.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {GoogleMapsModule} from '../google-maps-module';
77
import {
88
createMapConstructorSpy,
@@ -15,7 +15,7 @@ import {
1515
import {MapPolygon} from './map-polygon';
1616

1717
describe('MapPolygon', () => {
18-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
18+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
1919
let polygonPath: google.maps.LatLngLiteral[];
2020
let polygonOptions: google.maps.PolygonOptions;
2121

src/google-maps/map-polyline/map-polyline.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {GoogleMapsModule} from '../google-maps-module';
77
import {
88
createMapConstructorSpy,
@@ -15,7 +15,7 @@ import {
1515
import {MapPolyline} from './map-polyline';
1616

1717
describe('MapPolyline', () => {
18-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
18+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
1919
let polylinePath: google.maps.LatLngLiteral[];
2020
let polylineOptions: google.maps.PolylineOptions;
2121

src/google-maps/map-rectangle/map-rectangle.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, ViewChild} from '@angular/core';
22
import {async, TestBed} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44

5-
import {DEFAULT_OPTIONS, UpdatedGoogleMap} from '../google-map/google-map';
5+
import {DEFAULT_OPTIONS} from '../google-map/google-map';
66
import {GoogleMapsModule} from '../google-maps-module';
77
import {
88
createMapConstructorSpy,
@@ -15,7 +15,7 @@ import {
1515
import {MapRectangle} from './map-rectangle';
1616

1717
describe('MapRectangle', () => {
18-
let mapSpy: jasmine.SpyObj<UpdatedGoogleMap>;
18+
let mapSpy: jasmine.SpyObj<google.maps.Map>;
1919
let rectangleBounds: google.maps.LatLngBoundsLiteral;
2020
let rectangleOptions: google.maps.RectangleOptions;
2121

src/google-maps/testing/fake-google-map-utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {UpdatedGoogleMap} from '../google-map/google-map';
109

1110
/** Window interface for testing */
1211
export interface TestingWindow extends Window {
@@ -24,7 +23,7 @@ export interface TestingWindow extends Window {
2423
}
2524

2625
/** Creates a jasmine.SpyObj for a google.maps.Map. */
27-
export function createMapSpy(options: google.maps.MapOptions): jasmine.SpyObj<UpdatedGoogleMap> {
26+
export function createMapSpy(options: google.maps.MapOptions): jasmine.SpyObj<google.maps.Map> {
2827
const mapSpy = jasmine.createSpyObj('google.maps.Map', [
2928
'setOptions', 'setCenter', 'setZoom', 'setMap', 'addListener', 'fitBounds', 'panBy', 'panTo',
3029
'panToBounds', 'getBounds', 'getCenter', 'getClickableIcons', 'getHeading', 'getMapTypeId',
@@ -36,7 +35,7 @@ export function createMapSpy(options: google.maps.MapOptions): jasmine.SpyObj<Up
3635

3736
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Map. */
3837
export function createMapConstructorSpy(
39-
mapSpy: jasmine.SpyObj<UpdatedGoogleMap>, apiLoaded = true): jasmine.Spy {
38+
mapSpy: jasmine.SpyObj<google.maps.Map>, apiLoaded = true): jasmine.Spy {
4039
const mapConstructorSpy =
4140
jasmine.createSpy('Map constructor', (_el: Element, _options: google.maps.MapOptions) => {
4241
return mapSpy;

tools/public_api_guard/google-maps/google-maps.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export declare class GoogleMap implements OnChanges, OnInit, OnDestroy {
2-
_googleMap: UpdatedGoogleMap;
2+
_googleMap: google.maps.Map;
33
_isBrowser: boolean;
44
boundsChanged: Observable<void>;
55
set center(center: google.maps.LatLngLiteral | google.maps.LatLng);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,10 +1151,10 @@
11511151
"@types/minimatch" "*"
11521152
"@types/node" "*"
11531153

1154-
"@types/googlemaps@^3.37.0":
1155-
version "3.37.0"
1156-
resolved "https://registry.yarnpkg.com/@types/googlemaps/-/googlemaps-3.37.0.tgz#85596a2b93ded3850ac83ff575b66c34053c0ac8"
1157-
integrity sha512-kUF1DCVJISf6HZQdgROIs98C0MS40AK5KXxyOju5L1aifNXqMkN5siSGErHYxpEMkDcTA/hu6Dr22fZBTt2qRA==
1154+
"@types/googlemaps@^3.39.3":
1155+
version "3.39.3"
1156+
resolved "https://registry.yarnpkg.com/@types/googlemaps/-/googlemaps-3.39.3.tgz#8664e424f335802c8aa46a94676666b0a0f31d97"
1157+
integrity sha512-L8O9HAVFZj0TuiS8h5ORthiMsrrhjxTC8XUusp5k47oXCst4VTm+qWKvrAvmYMybZVokbp4Udco1mNwJrTNZPQ==
11581158

11591159
"@types/gulp@*":
11601160
version "4.0.5"

0 commit comments

Comments
 (0)