diff --git a/types/googlemaps/googlemaps-tests.ts b/types/googlemaps/googlemaps-tests.ts index ac7217dd17..f0d3249942 100644 --- a/types/googlemaps/googlemaps-tests.ts +++ b/types/googlemaps/googlemaps-tests.ts @@ -124,7 +124,7 @@ data.setStyle({ cursor: "pointer", fillColor: "#79B55B", fillOpacity: 1, - icon: { url: "//maps.google.com/mapfiles/ms/icons/blue.png" }, + icon: { url: "//maps.google.com/mapfiles/ms/icons/blue.png" } as google.maps.Icon, shape: { coords: [1, 2, 3], type: "circle" }, strokeColor: "#79B55B", strokeOpacity: 1, @@ -449,3 +449,8 @@ service.findPlaceFromPhoneNumber({ results[0].name; // $ExpectType string }); + +/***** google.maps.places.Autocomplete *****/ +const autocomplete = new google.maps.places.Autocomplete(document.createElement('input')); +const placeResult = autocomplete.getPlace(); +placeResult.name; // $ExpectType string diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 099bb9ef68..8cefde2426 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -11,6 +11,7 @@ // Sven Kreiss // Umar Bolatov // Michael Gauthier +// Colin Doig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -2726,29 +2727,29 @@ declare namespace google.maps { } export interface PlaceResult { - address_components: GeocoderAddressComponent[]; - adr_address: string; - aspects: PlaceAspectRating[]; - formatted_address: string; - formatted_phone_number: string; - geometry: PlaceGeometry; - html_attributions: string[]; - icon: string; - id: string; - international_phone_number: string; + address_components?: GeocoderAddressComponent[]; + adr_address?: string; + aspects?: PlaceAspectRating[]; + formatted_address?: string; + formatted_phone_number?: string; + geometry?: PlaceGeometry; + html_attributions?: string[]; + icon?: string; + id?: string; + international_phone_number?: string; name: string; - opening_hours: OpeningHours; - permanently_closed: boolean; - photos: PlacePhoto[]; - place_id: string; - price_level: number; - rating: number; - reviews: PlaceReview[]; - types: string[]; - url: string; - utc_offset: number; - vicinity: string; - website: string; + opening_hours?: OpeningHours; + permanently_closed?: boolean; + photos?: PlacePhoto[]; + place_id?: string; + price_level?: number; + rating?: number; + reviews?: PlaceReview[]; + types?: string[]; + url?: string; + utc_offset?: number; + vicinity?: string; + website?: string; } export interface PlaceReview {