googlemaps / googlemaps/google-maps-services-js

Incorrect typings for DirectionsStep.step, (should be DirectionsStep[])

Open
#1,319 2 comments 0 reactions 0 assignees View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
3.1k
Forks
654
Avg merge
3m
Merged PRs (30d)
4

Description

I'm using @googlemaps/google-maps-services-js 3.4.0.

The `DirectionsStep` type contains a `steps` property which should be `DirectionsStep[]`, but the included typings in `common.d.ts` define it as just `DirectionsStep`. In the API responses it's clearly an array, and the comment on it also says that it's supposed to be an array. Also, it should be optional.

Unless I'm missing something, I believe this is what common.d.ts:1024 should be:

```ts
export interface DirectionsStep {
/* ... */
/**
* contains detailed directions for walking or driving steps in transit directions.
* Substeps are only available when `travel_mode` is set to "transit".
* The inner `steps` array is of the same type as `steps`.
*/
- steps: DirectionsStep;
+ steps?: DirectionsStep[];
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.