all fields except "name" optional in PlaceResult

This commit is contained in:
Colin Doig
2019-02-19 11:52:28 +13:00
parent 72a3259557
commit 4892ced5f9
2 changed files with 29 additions and 23 deletions
+6 -1
View File
@@ -124,7 +124,7 @@ data.setStyle({
cursor: "pointer",
fillColor: "#79B55B",
fillOpacity: 1,
icon: <google.maps.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
+23 -22
View File
@@ -11,6 +11,7 @@
// Sven Kreiss <https://github.com/svenkreiss>
// Umar Bolatov <https://github.com/bolatovumar>
// Michael Gauthier <https://github.com/gauthierm>
// Colin Doig <https://github.com/captain-igloo>
// 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 {