axios icon indicating copy to clipboard operation
axios copied to clipboard

Extend use of concrete types in `AxiosRequestConfig` (replace `any`)

Open listman9 opened this issue 3 years ago • 0 comments

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

I'm using onDownloadProgress config on a request, and tried de-structuring the progressEvent which is of type any. I got an error from es-lint. Example code is attached:

  const response = await axios.get(someUrl, {
    onDownloadProgress: (progressEvent) => {
      const { loaded, total } = progressEvent;
      progressHandler.(Math.floor((loaded / total) * 100));
    }
  });

It was a bit frustrating and I ended up creating a partial interface for the response.

Describe the solution you'd like

Concrete types in 'AxiosRequestConfig'.

listman9 avatar Sep 22 '22 08:09 listman9