From cb7e3742f7e3f27162eb8c469ceb649ebfbf60fb Mon Sep 17 00:00:00 2001 From: William French Date: Thu, 31 Oct 2024 13:13:32 -0700 Subject: [PATCH] fix: Moves Place class declaration to avoid confusing pattern. Just a simple small change to move the Place class declaration into the function that's using it, to avoid using the pattern of passing Place as a function parameter. --- samples/place-class/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/place-class/index.ts b/samples/place-class/index.ts index cd58be021f..55cb5483dc 100644 --- a/samples/place-class/index.ts +++ b/samples/place-class/index.ts @@ -10,7 +10,6 @@ let centerCoordinates = { lat: 37.4161493, lng: -122.0812166 }; async function initMap() { const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; - const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary; map = new Map(document.getElementById('map') as HTMLElement, { center: centerCoordinates, @@ -20,11 +19,12 @@ async function initMap() { // [END_EXCLUDE] }); - getPlaceDetails(Place); + getPlaceDetails(); } // [START maps_place_class_fetchfields] -async function getPlaceDetails(Place) { +async function getPlaceDetails() { + const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary; const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; // Use place ID to create a new Place instance. const place = new Place({ @@ -50,4 +50,4 @@ async function getPlaceDetails(Place) { initMap(); // [END maps_place_class] -export { }; \ No newline at end of file +export { };