这是indexloc提供的服务,不要输入任何密码
Skip to content

TypeScript error in Request interfaces #1210

@StanislavHT

Description

@StanislavHT

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions