import { CancelToken, CancelTokenStatic } from 'axios'; export interface IJsonpOptionsWithoutUrl { dataType: 'jsonp' | 'JSONP'; data?: any; jsonp?: string; jsonpCallback?: string | (() => string); timeout?: number; cache?: boolean; prefix?: string; } export interface IAjaxOptionsWithoutUrl { data?: any; method?: string; dataType?: | 'json' | 'arraybuffer' | 'blob' | 'document' | 'text' | 'stream' | 'JSON' | 'TEXT' | 'STREAM' | 'BLOB' | 'DOCUMENT' | 'ARRAYBUFFER'; contentType?: string; headers?: { [key: string]: string }; withCredentials?: boolean; username?: string; password?: string; timeout?: number; noXRequestedWithHeader?: boolean; allowBigNumberInJSON?: boolean; onUploadProgress?: (progressEvent: any) => void; onDownloadProgress?: (progressEvent: any) => void; cancelToken?: CancelToken; } export interface IAjaxOptions extends IAjaxOptionsWithoutUrl { url: string; } export interface IJsonpOptions extends IJsonpOptionsWithoutUrl { url: string; } export type RequestOptionsWithoutUrl = IAjaxOptionsWithoutUrl | IJsonpOptionsWithoutUrl; export type RequestOptions = IAjaxOptions | IJsonpOptions; export interface IRequestConfig { transformRequest?: (options: RequestOptions) => RequestOptions; } declare function ajax( options: RequestOptions, config?: IRequestConfig ): Promise; declare namespace ajax { export const CancelToken: CancelTokenStatic; export function isCancel(value: any): boolean; } export default ajax;