Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript error in Request interfaces #1210

Open
StanislavHT opened this issue May 23, 2024 · 2 comments
Open

TypeScript error in Request interfaces #1210

StanislavHT opened this issue May 23, 2024 · 2 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@StanislavHT
Copy link

StanislavHT commented May 23, 2024

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<GeocodeRequest, 'params'> {
  params: Omit<Pick<GeocodeRequest, 'params'>, '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

@StanislavHT StanislavHT 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 May 23, 2024
@StanislavHT
Copy link
Author

I think all request interfaces should inherit Omit<Partial<AxiosRequestConfig>, 'params'>

@wangela
Copy link
Member

wangela commented May 23, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@StanislavHT Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants