something about the AxiosRequestConfig interface
See original GitHub issue#### Summary
I want the AxiosRequestConfig interface to be this:
{
url?: string;
method?: string;
baseURL?: string;
transformRequest?: AxiosTransformer | AxiosTransformer[];
transformResponse?: AxiosTransformer | AxiosTransformer[];
headers?: any;
params?: any;
paramsSerializer?: (params: any) => string;
data?: any;
timeout?: number;
withCredentials?: boolean;
adapter?: AxiosAdapter;
auth?: AxiosBasicCredentials;
responseType?: string;
xsrfCookieName?: string;
xsrfHeaderName?: string;
onUploadProgress?: (progressEvent: any) => void;
onDownloadProgress?: (progressEvent: any) => void;
maxContentLength?: number;
validateStatus?: (status: number) => boolean;
maxRedirects?: number;
httpAgent?: any;
httpsAgent?: any;
proxy?: AxiosProxyConfig | false;
cancelToken?: CancelToken;
// custom config
[someOtherConfig: string]: any;
}
So i can add some custom config without type matching error
#### Context
- axios version: e.g.: v0.17.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5
Top Results From Across the Web
Axios typescript customize AxiosRequestConfig - Stack Overflow
You can extend any library types, by using the typescript decleration merging feature. (docs). So this should do the job:
Read more >Interface: AxiosRequestConfig<D\> - Medusa
Properties · adapter · auth · baseURL · cancelToken · data · decompress · headers · httpAgent.
Read more >Retry API Call Axios Interceptor - StackBlitz
Blank starter project for building TypeScript apps.
Read more >resulting typing of axios from index.d.ts is incorrect : WEB-32066
export interface AxiosInstance { (config: AxiosRequestConfig): AxiosPromise; (url: string, config?: AxiosRequestConfig): AxiosPromise; defaults: ...
Read more >How to Perform HTTP Requests with Axios – A Complete Guide
Sending multiple requests with this interface, on the other hand, ... axios.request(config) axios.get(url[, config]) axios.delete(url[, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I will recommend a
customConfig: object | null
property to be added to the interface which allows users to add unlimited custom configuration without type errors.I am open submitting a PR for this if the community deems it necessary.
Any update on this?
Edit Those seeking a solution. Create your own
axios.d.ts
file and put it in the root of your project.