Open alexsantos-eth opened 3 years ago
Thanks for sharing. I still couldn't find any types, so here's the slightly more up-to-date version of your type that I'm using.
The only difference really is that there is a new property legs.via_waypoints
and that I have changed the location properties to [number, number] as coordinates are always returned in this format.
export interface MapboxDirections {
code: string
uuid: string
waypoints: {
distance: number
name: string
location: [number, number]
}[]
routes: {
distance: number
duration: number
geometry: {
coordinates: [number, number][]
type: string
}
legs: {
via_waypoints: [],
admins: {
iso_3166_1: string
iso_3166_1_alpha3: string
}[]
distance: number
duration: number
steps: []
summary: string
weight: number
}[]
weight: number
weight_name: string
}[]
}
P.S. Note that legs.via_waypoints
and legs.steps
must be typed separately if these features are to be used.
I dont found any typescript definition file for ApiResponse here. maybe like this?