The following code is used to add a cookie jar to an axios instance. It fails because the interface AxiosRequestConfig doesn't contain a member named "jar". Can I augment the existing AxiosRequestConfig type, or is there a workaround for this?
const tough = require('tough-cookie');
const axiosCookieJarSupport = require('axios-cookiejar-support').default;
//...
const instance = axios.create();
axiosCookieJarSupport(instance);
instance.defaults.jar = new tough.CookieJar();
The error message from typescript is "Property 'jar' does not exist on type 'AxiosRequestConfig'", which is true, but how do I fix it?
For me it works as below: