diff --git a/index.d.ts b/index.d.ts index 8a571eae6d..c860d8662c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -62,7 +62,7 @@ export interface AxiosRequestConfig { onUploadProgress?: (progressEvent: any) => void; onDownloadProgress?: (progressEvent: any) => void; maxContentLength?: number; - validateStatus?: ((status: number) => boolean | null); + validateStatus?: ((status: number) => boolean) | null; maxBodyLength?: number; maxRedirects?: number; socketPath?: string | null; diff --git a/test/typescript/axios.ts b/test/typescript/axios.ts index c584dfc578..c244cb1aa7 100644 --- a/test/typescript/axios.ts +++ b/test/typescript/axios.ts @@ -44,6 +44,14 @@ const config: AxiosRequestConfig = { cancelToken: new axios.CancelToken((cancel: Canceler) => {}) }; +const nullValidateStatusConfig: AxiosRequestConfig = { + validateStatus: null +}; + +const undefinedValidateStatusConfig: AxiosRequestConfig = { + validateStatus: undefined +}; + const handleResponse = (response: AxiosResponse) => { console.log(response.data); console.log(response.status);