nuxt-community / axios-module

Secure and easy axios integration for Nuxt 2
https://axios.nuxtjs.org
MIT License
1.19k stars 245 forks source link

Extended Axios.AxiosRequestConfig from #408 breaks interceptor types #441

Closed mgdodge closed 3 years ago

mgdodge commented 4 years ago

Using 5.12.1, things work fine. Installing 5.12.2 (which introduces the change from #408) breaks things pretty badly.

For example, I use something like

$axios.onRequest((config: AxiosRequestConfig) => {
  // Do stuff
  return config;
})

because request interceptors should always return the config.

5.12.1 doesn't complain at all. But 5.12.2 refuses to build. The error is:

Error:(72, 19) TS2345: Argument of type '(config: AxiosRequestConfig) => AxiosRequestConfig' is not assignable to parameter of type '(config: AxiosRequestConfig) => void'. Types of parameters 'config' and 'config' are incompatible.