Skip to content

Add undefined as a value in AxiosRequestConfig properties to avoid compilation errors with exactOptionalPropertyTypes enabled #5559

@AlbertoSadoc

Description

@AlbertoSadoc

Is your feature request related to a problem? Please describe.

A compilation error happens when TS exactOptionalPropertyTypes flag is enabled and undefined is passed to a property in AxiosRequestConfig.

Describe the solution you'd like

Since the code seems to check that the cancelToken exists or not, would it be possible to add undefined as a value in the types?

function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}

Describe alternatives you've considered

No response

Additional context/Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    status::add-to-docsContains content that needs to be included in our docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions