From 8e168b06ddc697f1696c7d08c2aec7d8b113ffbb Mon Sep 17 00:00:00 2001 From: Latif Sulistyo Date: Fri, 3 Dec 2021 06:01:30 +0700 Subject: [PATCH] Format `index.d.ts` file --- index.d.ts | 87 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/index.d.ts b/index.d.ts index a52c312fb6..a5c53f7a3c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,7 +3,7 @@ export type AxiosRequestHeaders = Record; export type AxiosResponseHeaders = Record & { - "set-cookie"?: string[] + 'set-cookie'?: string[]; }; export interface AxiosRequestTransformer { @@ -34,16 +34,26 @@ export interface AxiosProxyConfig { } export type Method = - | 'get' | 'GET' - | 'delete' | 'DELETE' - | 'head' | 'HEAD' - | 'options' | 'OPTIONS' - | 'post' | 'POST' - | 'put' | 'PUT' - | 'patch' | 'PATCH' - | 'purge' | 'PURGE' - | 'link' | 'LINK' - | 'unlink' | 'UNLINK'; + | 'get' + | 'GET' + | 'delete' + | 'DELETE' + | 'head' + | 'HEAD' + | 'options' + | 'OPTIONS' + | 'post' + | 'POST' + | 'put' + | 'PUT' + | 'patch' + | 'PATCH' + | 'purge' + | 'PURGE' + | 'link' + | 'LINK' + | 'unlink' + | 'UNLINK'; export type ResponseType = | 'arraybuffer' @@ -108,11 +118,12 @@ export interface HeadersDefaults { unlink?: AxiosRequestHeaders; } -export interface AxiosDefaults extends Omit, 'headers'> { +export interface AxiosDefaults + extends Omit, 'headers'> { headers: HeadersDefaults; } -export interface AxiosResponse { +export interface AxiosResponse { data: T; status: number; statusText: string; @@ -130,8 +141,7 @@ export interface AxiosError extends Error { toJSON: () => object; } -export interface AxiosPromise extends Promise> { -} +export interface AxiosPromise extends Promise> {} export interface CancelStatic { new (message?: string): Cancel; @@ -162,7 +172,10 @@ export interface CancelTokenSource { } export interface AxiosInterceptorManager { - use(onFulfilled?: (value: V) => T | Promise, onRejected?: (error: any) => any): number; + use( + onFulfilled?: (value: V) => T | Promise, + onRejected?: (error: any) => any + ): number; eject(id: number): void; } @@ -174,14 +187,40 @@ export class Axios { response: AxiosInterceptorManager; }; getUri(config?: AxiosRequestConfig): string; - request, D = any>(config: AxiosRequestConfig): Promise; - get, D = any>(url: string, config?: AxiosRequestConfig): Promise; - delete, D = any>(url: string, config?: AxiosRequestConfig): Promise; - head, D = any>(url: string, config?: AxiosRequestConfig): Promise; - options, D = any>(url: string, config?: AxiosRequestConfig): Promise; - post, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; - put, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; - patch, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + request, D = any>( + config: AxiosRequestConfig + ): Promise; + get, D = any>( + url: string, + config?: AxiosRequestConfig + ): Promise; + delete, D = any>( + url: string, + config?: AxiosRequestConfig + ): Promise; + head, D = any>( + url: string, + config?: AxiosRequestConfig + ): Promise; + options, D = any>( + url: string, + config?: AxiosRequestConfig + ): Promise; + post, D = any>( + url: string, + data?: D, + config?: AxiosRequestConfig + ): Promise; + put, D = any>( + url: string, + data?: D, + config?: AxiosRequestConfig + ): Promise; + patch, D = any>( + url: string, + data?: D, + config?: AxiosRequestConfig + ): Promise; } export interface AxiosInstance extends Axios {