Skip to content

Version 0.22.0 breaks TypeScript apps #4157

@mrlubos

Description

@mrlubos

Describe the bug

Upgrading from version 0.21.4 to 0.22.0 fails to compile a TypeScript app.

To Reproduce

Have a code that looks like this

import axios from 'axios';

const func = () => {
  delete axios.defaults.headers.common.Authorization;
}

Request responses are also incorrectly inferred after this update. Instead of any, data will be set to Params.

import axios from 'axios';

export const request = async (params: Params): Promise<Response> => {
  const { data } = await axios.put('urlPath', params);
  return data;
};

Expected behavior

There should be no breaking changes as change log doesn't mention them.

Environment

  • Axios Version [e.g. 0.18.0] 0.22.0
  • Adapter [e.g. XHR/HTTP] -
  • Browser [e.g. Chrome, Safari] -
  • Browser Version [e.g. 22] -
  • Node.js Version [e.g. 13.0.1] -
  • OS: [e.g. iOS 12.1.0, OSX 10.13.4] -
  • Additional Library Versions [e.g. React 16.7, React Native 0.58.0] React 17.0.2

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions