Skip to content

Commit 84388b0

Browse files
Sako HartounianJustinBeckwith
authored andcommitted
cleaner definitions with union types. (axios#1551)
1 parent 787c808 commit 84388b0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

index.d.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,26 @@ export interface AxiosProxyConfig {
2020
}
2121
}
2222

23+
export type Method =
24+
| 'get'
25+
| 'delete'
26+
| 'head'
27+
| 'options'
28+
| 'post'
29+
| 'put'
30+
| 'patch'
31+
32+
export type ResponseType =
33+
| 'arraybuffer'
34+
| 'blob'
35+
| 'document'
36+
| 'json'
37+
| 'text'
38+
| 'stream'
39+
2340
export interface AxiosRequestConfig {
2441
url?: string;
25-
method?: 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch';
42+
method?: Method;
2643
baseURL?: string;
2744
transformRequest?: AxiosTransformer | AxiosTransformer[];
2845
transformResponse?: AxiosTransformer | AxiosTransformer[];
@@ -34,7 +51,7 @@ export interface AxiosRequestConfig {
3451
withCredentials?: boolean;
3552
adapter?: AxiosAdapter;
3653
auth?: AxiosBasicCredentials;
37-
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
54+
responseType?: ResponseType;
3855
xsrfCookieName?: string;
3956
xsrfHeaderName?: string;
4057
onUploadProgress?: (progressEvent: any) => void;

0 commit comments

Comments
 (0)