googlemaps / googlemaps/google-maps-services-js

TypeScript error in Request interfaces

Open
#1,210 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

Now request interfaces like `DistanceMatrixRequest`, `GeocodeRequest` extends `AxiosRequestConfig` which has params (type: any).

In my case I just want to omit key from request params because we set key globally, so I defined following interface.
```
interface IKeyOmittedGeocodeRequest extends Omit {
params: Omit, 'key'>;
}
```

But as `GeocodeRequest` extends `AxiosRequestConfig` which has params, `TypeScript` recognizes params in `IKeyOmittedGoecodeRequest` from `AxiosRequestConfig` which is any.
And it doesn't recognize `request.params.destinations`.

![image](https://github.com/googlemaps/google-maps-services-js/assets/146730721/212d2d9b-e503-479f-8c93-4ff31779aba2)

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.