Closed sunilsharma2214 closed 4 years ago
You need the typing
declare module 'axios' {
interface AxiosRequestConfig {
cache?: boolean;
}
}
here is the solution https://github.com/kuitos/axios-extensions#custom-cache-typing
I try not to comment on closed issues but... I'm getting:
node_modules/axios-extensions/esm"' has no exported member 'ICacheLike'
using the solution above.
Oh, I guess the change not released yet.
released v3.1.2, thanks for your feedback~
axios.ts file const axiosAppInstance = axios.create({ // @ts-ignore adapter: cacheAdapterEnhancer(axios.defaults.adapter, { enabledByDefault: false, cacheFlag: 'useCache'}), baseURL: appConfig.getRequired('abc'), });
abc.ts file axiosAppInstance.get('xyz',{ useCache: true }),
TypeScript error Argument of type '{ useCache: boolean; }' is not assignable to parameter of type 'AxiosRequestConfig'. Object literal may only specify known properties, and 'useCache' does not exist in type 'AxiosRequestConfig'.ts