index.d.cts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. interface RawAxiosHeaders {
  2. [key: string]: axios.AxiosHeaderValue;
  3. }
  4. type MethodsHeaders = Partial<{
  5. [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
  6. } & {common: AxiosHeaders}>;
  7. type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);
  8. type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
  9. type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';
  10. type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
  11. type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
  12. type BrowserProgressEvent = any;
  13. declare class AxiosHeaders {
  14. constructor(
  15. headers?: RawAxiosHeaders | AxiosHeaders | string
  16. );
  17. [key: string]: any;
  18. set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  19. set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
  20. get(headerName: string, parser: RegExp): RegExpExecArray | null;
  21. get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;
  22. has(header: string, matcher?: AxiosHeaderMatcher): boolean;
  23. delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
  24. clear(matcher?: AxiosHeaderMatcher): boolean;
  25. normalize(format: boolean): AxiosHeaders;
  26. concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
  27. toJSON(asStrings?: boolean): RawAxiosHeaders;
  28. static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
  29. static accessor(header: string | string[]): AxiosHeaders;
  30. static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
  31. setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  32. getContentType(parser?: RegExp): RegExpExecArray | null;
  33. getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  34. hasContentType(matcher?: AxiosHeaderMatcher): boolean;
  35. setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  36. getContentLength(parser?: RegExp): RegExpExecArray | null;
  37. getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  38. hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
  39. setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  40. getAccept(parser?: RegExp): RegExpExecArray | null;
  41. getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  42. hasAccept(matcher?: AxiosHeaderMatcher): boolean;
  43. setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  44. getUserAgent(parser?: RegExp): RegExpExecArray | null;
  45. getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  46. hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
  47. setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  48. getContentEncoding(parser?: RegExp): RegExpExecArray | null;
  49. getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  50. hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
  51. setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
  52. getAuthorization(parser?: RegExp): RegExpExecArray | null;
  53. getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
  54. hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
  55. getSetCookie(): string[];
  56. [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>;
  57. }
  58. declare class AxiosError<T = unknown, D = any> extends Error {
  59. constructor(
  60. message?: string,
  61. code?: string,
  62. config?: axios.InternalAxiosRequestConfig<D>,
  63. request?: any,
  64. response?: axios.AxiosResponse<T, D>
  65. );
  66. config?: axios.InternalAxiosRequestConfig<D>;
  67. code?: string;
  68. request?: any;
  69. response?: axios.AxiosResponse<T, D>;
  70. isAxiosError: boolean;
  71. status?: number;
  72. toJSON: () => object;
  73. cause?: unknown;
  74. event?: BrowserProgressEvent;
  75. static from<T = unknown, D = any>(
  76. error: Error | unknown,
  77. code?: string,
  78. config?: axios.InternalAxiosRequestConfig<D>,
  79. request?: any,
  80. response?: axios.AxiosResponse<T, D>,
  81. customProps?: object,
  82. ): AxiosError<T, D>;
  83. static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
  84. static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
  85. static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
  86. static readonly ERR_NETWORK = "ERR_NETWORK";
  87. static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
  88. static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
  89. static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
  90. static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
  91. static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
  92. static readonly ERR_CANCELED = "ERR_CANCELED";
  93. static readonly ECONNABORTED = "ECONNABORTED";
  94. static readonly ETIMEDOUT = "ETIMEDOUT";
  95. }
  96. declare class CanceledError<T> extends AxiosError<T> {
  97. }
  98. declare class Axios {
  99. constructor(config?: axios.AxiosRequestConfig);
  100. defaults: axios.AxiosDefaults;
  101. interceptors: {
  102. request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
  103. response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
  104. };
  105. getUri(config?: axios.AxiosRequestConfig): string;
  106. request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;
  107. get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  108. delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  109. head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  110. options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  111. post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  112. put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  113. patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  114. postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  115. putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  116. patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
  117. }
  118. declare enum HttpStatusCode {
  119. Continue = 100,
  120. SwitchingProtocols = 101,
  121. Processing = 102,
  122. EarlyHints = 103,
  123. Ok = 200,
  124. Created = 201,
  125. Accepted = 202,
  126. NonAuthoritativeInformation = 203,
  127. NoContent = 204,
  128. ResetContent = 205,
  129. PartialContent = 206,
  130. MultiStatus = 207,
  131. AlreadyReported = 208,
  132. ImUsed = 226,
  133. MultipleChoices = 300,
  134. MovedPermanently = 301,
  135. Found = 302,
  136. SeeOther = 303,
  137. NotModified = 304,
  138. UseProxy = 305,
  139. Unused = 306,
  140. TemporaryRedirect = 307,
  141. PermanentRedirect = 308,
  142. BadRequest = 400,
  143. Unauthorized = 401,
  144. PaymentRequired = 402,
  145. Forbidden = 403,
  146. NotFound = 404,
  147. MethodNotAllowed = 405,
  148. NotAcceptable = 406,
  149. ProxyAuthenticationRequired = 407,
  150. RequestTimeout = 408,
  151. Conflict = 409,
  152. Gone = 410,
  153. LengthRequired = 411,
  154. PreconditionFailed = 412,
  155. PayloadTooLarge = 413,
  156. UriTooLong = 414,
  157. UnsupportedMediaType = 415,
  158. RangeNotSatisfiable = 416,
  159. ExpectationFailed = 417,
  160. ImATeapot = 418,
  161. MisdirectedRequest = 421,
  162. UnprocessableEntity = 422,
  163. Locked = 423,
  164. FailedDependency = 424,
  165. TooEarly = 425,
  166. UpgradeRequired = 426,
  167. PreconditionRequired = 428,
  168. TooManyRequests = 429,
  169. RequestHeaderFieldsTooLarge = 431,
  170. UnavailableForLegalReasons = 451,
  171. InternalServerError = 500,
  172. NotImplemented = 501,
  173. BadGateway = 502,
  174. ServiceUnavailable = 503,
  175. GatewayTimeout = 504,
  176. HttpVersionNotSupported = 505,
  177. VariantAlsoNegotiates = 506,
  178. InsufficientStorage = 507,
  179. LoopDetected = 508,
  180. NotExtended = 510,
  181. NetworkAuthenticationRequired = 511,
  182. }
  183. type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
  184. declare namespace axios {
  185. type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
  186. type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
  187. [Key in CommonRequestHeadersList]: AxiosHeaderValue;
  188. } & {
  189. 'Content-Type': ContentType
  190. }>;
  191. type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
  192. type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
  193. type RawCommonResponseHeaders = {
  194. [Key in CommonResponseHeadersList]: AxiosHeaderValue;
  195. } & {
  196. "set-cookie": string[];
  197. };
  198. type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
  199. type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
  200. interface AxiosRequestTransformer {
  201. (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
  202. }
  203. interface AxiosResponseTransformer {
  204. (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
  205. }
  206. interface AxiosAdapter {
  207. (config: InternalAxiosRequestConfig): AxiosPromise;
  208. }
  209. interface AxiosBasicCredentials {
  210. username: string;
  211. password: string;
  212. }
  213. interface AxiosProxyConfig {
  214. host: string;
  215. port: number;
  216. auth?: AxiosBasicCredentials;
  217. protocol?: string;
  218. }
  219. type Method =
  220. | 'get' | 'GET'
  221. | 'delete' | 'DELETE'
  222. | 'head' | 'HEAD'
  223. | 'options' | 'OPTIONS'
  224. | 'post' | 'POST'
  225. | 'put' | 'PUT'
  226. | 'patch' | 'PATCH'
  227. | 'purge' | 'PURGE'
  228. | 'link' | 'LINK'
  229. | 'unlink' | 'UNLINK';
  230. type ResponseType =
  231. | 'arraybuffer'
  232. | 'blob'
  233. | 'document'
  234. | 'json'
  235. | 'text'
  236. | 'stream'
  237. | 'formdata';
  238. type responseEncoding =
  239. | 'ascii' | 'ASCII'
  240. | 'ansi' | 'ANSI'
  241. | 'binary' | 'BINARY'
  242. | 'base64' | 'BASE64'
  243. | 'base64url' | 'BASE64URL'
  244. | 'hex' | 'HEX'
  245. | 'latin1' | 'LATIN1'
  246. | 'ucs-2' | 'UCS-2'
  247. | 'ucs2' | 'UCS2'
  248. | 'utf-8' | 'UTF-8'
  249. | 'utf8' | 'UTF8'
  250. | 'utf16le' | 'UTF16LE';
  251. interface TransitionalOptions {
  252. silentJSONParsing?: boolean;
  253. forcedJSONParsing?: boolean;
  254. clarifyTimeoutError?: boolean;
  255. }
  256. interface GenericAbortSignal {
  257. readonly aborted: boolean;
  258. onabort?: ((...args: any) => any) | null;
  259. addEventListener?: (...args: any) => any;
  260. removeEventListener?: (...args: any) => any;
  261. }
  262. interface FormDataVisitorHelpers {
  263. defaultVisitor: SerializerVisitor;
  264. convertValue: (value: any) => any;
  265. isVisitable: (value: any) => boolean;
  266. }
  267. interface SerializerVisitor {
  268. (
  269. this: GenericFormData,
  270. value: any,
  271. key: string | number,
  272. path: null | Array<string | number>,
  273. helpers: FormDataVisitorHelpers
  274. ): boolean;
  275. }
  276. interface SerializerOptions {
  277. visitor?: SerializerVisitor;
  278. dots?: boolean;
  279. metaTokens?: boolean;
  280. indexes?: boolean | null;
  281. }
  282. // tslint:disable-next-line
  283. interface FormSerializerOptions extends SerializerOptions {
  284. }
  285. interface ParamEncoder {
  286. (value: any, defaultEncoder: (value: any) => any): any;
  287. }
  288. interface CustomParamsSerializer {
  289. (params: Record<string, any>, options?: ParamsSerializerOptions): string;
  290. }
  291. interface ParamsSerializerOptions extends SerializerOptions {
  292. encode?: ParamEncoder;
  293. serialize?: CustomParamsSerializer;
  294. }
  295. type MaxUploadRate = number;
  296. type MaxDownloadRate = number;
  297. interface AxiosProgressEvent {
  298. loaded: number;
  299. total?: number;
  300. progress?: number;
  301. bytes: number;
  302. rate?: number;
  303. estimated?: number;
  304. upload?: boolean;
  305. download?: boolean;
  306. event?: BrowserProgressEvent;
  307. lengthComputable: boolean;
  308. }
  309. type Milliseconds = number;
  310. type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | (string & {});
  311. type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
  312. type AddressFamily = 4 | 6 | undefined;
  313. interface LookupAddressEntry {
  314. address: string;
  315. family?: AddressFamily;
  316. }
  317. type LookupAddress = string | LookupAddressEntry;
  318. interface AxiosRequestConfig<D = any> {
  319. url?: string;
  320. method?: Method | string;
  321. baseURL?: string;
  322. allowAbsoluteUrls?: boolean;
  323. transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
  324. transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
  325. headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
  326. params?: any;
  327. paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
  328. data?: D;
  329. timeout?: Milliseconds;
  330. timeoutErrorMessage?: string;
  331. withCredentials?: boolean;
  332. adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
  333. auth?: AxiosBasicCredentials;
  334. responseType?: ResponseType;
  335. responseEncoding?: responseEncoding | string;
  336. xsrfCookieName?: string;
  337. xsrfHeaderName?: string;
  338. onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
  339. onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
  340. maxContentLength?: number;
  341. validateStatus?: ((status: number) => boolean) | null;
  342. maxBodyLength?: number;
  343. maxRedirects?: number;
  344. maxRate?: number | [MaxUploadRate, MaxDownloadRate];
  345. beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
  346. socketPath?: string | null;
  347. transport?: any;
  348. httpAgent?: any;
  349. httpsAgent?: any;
  350. proxy?: AxiosProxyConfig | false;
  351. cancelToken?: CancelToken;
  352. decompress?: boolean;
  353. transitional?: TransitionalOptions;
  354. signal?: GenericAbortSignal;
  355. insecureHTTPParser?: boolean;
  356. env?: {
  357. FormData?: new (...args: any[]) => object;
  358. fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>;
  359. Request?: new (input: URL | Request | string, init?: RequestInit) => Request;
  360. Response?: new (
  361. body?: ArrayBuffer | ArrayBufferView | Blob | FormData | URLSearchParams | string | null,
  362. init?: ResponseInit
  363. ) => Response;
  364. };
  365. formSerializer?: FormSerializerOptions;
  366. family?: AddressFamily;
  367. lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
  368. ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
  369. withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
  370. fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
  371. }
  372. // Alias
  373. type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
  374. interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
  375. headers: AxiosRequestHeaders;
  376. }
  377. interface HeadersDefaults {
  378. common: RawAxiosRequestHeaders;
  379. delete: RawAxiosRequestHeaders;
  380. get: RawAxiosRequestHeaders;
  381. head: RawAxiosRequestHeaders;
  382. post: RawAxiosRequestHeaders;
  383. put: RawAxiosRequestHeaders;
  384. patch: RawAxiosRequestHeaders;
  385. options?: RawAxiosRequestHeaders;
  386. purge?: RawAxiosRequestHeaders;
  387. link?: RawAxiosRequestHeaders;
  388. unlink?: RawAxiosRequestHeaders;
  389. }
  390. interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
  391. headers: HeadersDefaults;
  392. }
  393. interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
  394. headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
  395. }
  396. interface AxiosResponse<T = any, D = any, H = {}> {
  397. data: T;
  398. status: number;
  399. statusText: string;
  400. headers: H & RawAxiosResponseHeaders | AxiosResponseHeaders;
  401. config: InternalAxiosRequestConfig<D>;
  402. request?: any;
  403. }
  404. type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
  405. interface CancelStatic {
  406. new (message?: string): Cancel;
  407. }
  408. interface Cancel {
  409. message: string | undefined;
  410. }
  411. interface Canceler {
  412. (message?: string, config?: AxiosRequestConfig, request?: any): void;
  413. }
  414. interface CancelTokenStatic {
  415. new (executor: (cancel: Canceler) => void): CancelToken;
  416. source(): CancelTokenSource;
  417. }
  418. interface CancelToken {
  419. promise: Promise<Cancel>;
  420. reason?: Cancel;
  421. throwIfRequested(): void;
  422. }
  423. interface CancelTokenSource {
  424. token: CancelToken;
  425. cancel: Canceler;
  426. }
  427. interface AxiosInterceptorOptions {
  428. synchronous?: boolean;
  429. runWhen?: (config: InternalAxiosRequestConfig) => boolean;
  430. }
  431. type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
  432. type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
  433. interface AxiosInterceptorManager<V> {
  434. use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
  435. eject(id: number): void;
  436. clear(): void;
  437. }
  438. interface AxiosInstance extends Axios {
  439. <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
  440. <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
  441. create(config?: CreateAxiosDefaults): AxiosInstance;
  442. defaults: Omit<AxiosDefaults, 'headers'> & {
  443. headers: HeadersDefaults & {
  444. [key: string]: AxiosHeaderValue
  445. }
  446. };
  447. }
  448. interface GenericFormData {
  449. append(name: string, value: any, options?: any): any;
  450. }
  451. interface GenericHTMLFormElement {
  452. name: string;
  453. method: string;
  454. submit(): void;
  455. }
  456. interface AxiosStatic extends AxiosInstance {
  457. Cancel: CancelStatic;
  458. CancelToken: CancelTokenStatic;
  459. Axios: typeof Axios;
  460. AxiosError: typeof AxiosError;
  461. CanceledError: typeof CanceledError;
  462. HttpStatusCode: typeof HttpStatusCode;
  463. readonly VERSION: string;
  464. isCancel(value: any): value is Cancel;
  465. all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
  466. spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
  467. isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
  468. toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
  469. formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
  470. getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
  471. AxiosHeaders: typeof AxiosHeaders;
  472. mergeConfig<D = any>(config1: AxiosRequestConfig<D>, config2: AxiosRequestConfig<D>): AxiosRequestConfig<D>;
  473. }
  474. }
  475. declare const axios: axios.AxiosStatic;
  476. export = axios;