mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Allow steps to be nested under google.maps.DirectionsLeg (#37963)
This commit is contained in:
committed by
Ron Buckton
parent
0d45a2d5af
commit
846d821ff5
@@ -793,3 +793,31 @@ const directionsWaypointLocationPlace: google.maps.DirectionsWaypoint = {
|
||||
const directionsWaypointStopover: google.maps.DirectionsWaypoint = {
|
||||
stopover: true,
|
||||
};
|
||||
|
||||
/***** google.maps.DirectionsService *****/
|
||||
let directionsService = new google.maps.DirectionsService();
|
||||
|
||||
directionsService.route({
|
||||
avoidFerries: true,
|
||||
avoidHighways: true,
|
||||
avoidTolls: true,
|
||||
destination: 'destination',
|
||||
origin: 'origin',
|
||||
provideRouteAlternatives: true,
|
||||
transitOptions: {
|
||||
arrivalTime: new Date(),
|
||||
departureTime: new Date(),
|
||||
modes: [
|
||||
google.maps.TransitMode.BUS,
|
||||
google.maps.TransitMode.RAIL
|
||||
],
|
||||
routingPreference: google.maps.TransitRoutePreference.FEWER_TRANSFERS
|
||||
},
|
||||
travelMode: google.maps.TravelMode.TRANSIT,
|
||||
unitSystem: google.maps.UnitSystem.IMPERIAL
|
||||
}, (result: google.maps.DirectionsResult, status: google.maps.DirectionsStatus) => {
|
||||
const routes = result.routes; // $ExpectType DirectionsRoute[]
|
||||
const legs = routes[0].legs; // $ExpectType DirectionsLeg[]
|
||||
const steps = legs[0].steps; // $ExpectType DirectionsStep[]
|
||||
steps[0].steps; // $ExpectType BaseDirectionsStep[]
|
||||
});
|
||||
|
||||
Vendored
+8
-2
@@ -1977,18 +1977,24 @@ declare namespace google.maps {
|
||||
via_waypoints: LatLng[];
|
||||
}
|
||||
|
||||
interface DirectionsStep {
|
||||
interface BaseDirectionsStep {
|
||||
distance: Distance;
|
||||
duration: Duration;
|
||||
end_location: LatLng;
|
||||
instructions: string;
|
||||
path: LatLng[];
|
||||
start_location: LatLng;
|
||||
steps: DirectionsStep;
|
||||
transit: TransitDetails;
|
||||
travel_mode: TravelMode;
|
||||
}
|
||||
|
||||
interface DirectionsStep extends BaseDirectionsStep {
|
||||
/**
|
||||
* This field will only be available if travel_mode is set to TRANSIT.
|
||||
*/
|
||||
steps: BaseDirectionsStep[];
|
||||
}
|
||||
|
||||
interface Distance {
|
||||
text: string;
|
||||
value: number;
|
||||
|
||||
Reference in New Issue
Block a user