You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to use the via_waypoint field of the DirectionsLeg (that is called routeLeg inside your code for some reason) I got this error Property 'via_waypoint' does not exist on type 'RouteLeg'.ts(2339 but the data is present in the response and your documentation
an other thing that is wierd in the doc and may be related, it is said for the Directions.legs:
A separate leg will be present for each waypoint or destination specified.
But this is not the case actually if I send 0, 1, 13 waypoint i only got one leg what is the reel expected behavior ?
try to use directions.data.routes[i].legs[i].via_waypoint
you will got typescript error
Code example
import{Client}from'@googlemaps/google-maps-services-js';constkey=process.env.GOOGLE_API_KEY||'';constclient=newClient({});exportconstgetDistanceMatrix=(addresses: string[],departureTime?: Date): Promise<void>=>client.directions({// eslint-disable-next-line @typescript-eslint/ban-ts-comment// @ts-ignore: TS2322params: {
key,origin: addresses[0],destination: addresses[addresses.length-1],waypoints: addresses.slice(1,-1).map((address)=>`via:${address}`),
...departureTime
? {traffic_model: 'best_guess',departure_time: departureTime,}
: {},alternatives: true,},}).then((directions)=>{console.log(directions.data.routes[0].legs[0].via_waypoint)})constadresses=["25 Rue de la Marbrerie, Lille, France","18 Rue Jules Guesde, 59650 Villeneuve-d'Ascq, France","Ecole Elémentaire Voltaire-Sévigné, Rue Emile Zola Lomme, Lille, France"]getDistanceMatrix(adresses)
The text was updated successfully, but these errors were encountered:
kataiga
added
triage me
I really want to be triaged.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
labels
Dec 21, 2022
Hello,
When I try to use the via_waypoint field of the DirectionsLeg (that is called
routeLeg
inside your code for some reason) I got this errorProperty 'via_waypoint' does not exist on type 'RouteLeg'.ts(2339
but the data is present in the response and your documentationan other thing that is wierd in the doc and may be related, it is said for the Directions.legs:
But this is not the case actually if I send 0, 1, 13 waypoint i only got one leg what is the reel expected behavior ?
Environment details
NodeJS v16.14
npm package @googlemaps/google-maps-services-js v3.3.16
Steps to reproduce
directions.data.routes[i].legs[i].via_waypoint
Code example
The text was updated successfully, but these errors were encountered: