@@ -76,6 +76,7 @@ async function initMap(): Promise<void> {
7676 } ;
7777 // [END maps_routes_get_directions_request_pluscode]
7878
79+ // [START maps_routes_get_directions_request_complete]
7980 // [START maps_routes_get_directions_request_simple]
8081 // Define a routes request.
8182 const request = {
@@ -87,14 +88,10 @@ async function initMap(): Promise<void> {
8788 // [END maps_routes_get_directions_request_simple]
8889
8990 // Call computeRoutes to get the directions.
90- //@ts -ignore
9191 // [START maps_routes_get_directions_compute]
9292 const { routes, fallbackInfo, geocodingResults} = await Route . computeRoutes ( request ) ;
9393 // [END maps_routes_get_directions_compute]
9494
95- // Display the raw JSON for the result in the console.
96- console . log ( `Response:\n ${ JSON . stringify ( routes , null , 2 ) } ` ) ;
97-
9895 // [START maps_routes_get_directions_polyline]
9996 // Use createPolylines to create polylines for the route.
10097 mapPolylines = routes [ 0 ] . createPolylines ( ) ;
@@ -106,7 +103,12 @@ async function initMap(): Promise<void> {
106103 // Add markers to the map
107104 markers . forEach ( ( marker ) => marker . setMap ( map ) ) ;
108105 // [END maps_routes_get_directions_polyline]
106+ // [END maps_routes_get_directions_request_complete]
107+
108+ // Display the raw JSON for the result in the console.
109+ console . log ( `Response:\n ${ JSON . stringify ( routes , null , 2 ) } ` ) ;
109110
111+ // Fit the map to the path.
110112 fitMapToPath ( routes [ 0 ] . path ! ) ;
111113}
112114
0 commit comments