From 12fff93e90e218ff5f743863860ab6f003a701ce Mon Sep 17 00:00:00 2001 From: LS Date: Thu, 27 May 2021 12:43:01 +0700 Subject: [PATCH] Fixing `isAxiosError` typings to take generics --- index.d.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/index.d.ts b/index.d.ts index a71d03e3ed..7186f12c4b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -16,7 +16,7 @@ export interface AxiosProxyConfig { port: number; auth?: { username: string; - password:string; + password: string; }; protocol?: string; } @@ -31,7 +31,7 @@ export type Method = | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' - | 'unlink' | 'UNLINK' + | 'unlink' | 'UNLINK'; export type ResponseType = | 'arraybuffer' @@ -39,9 +39,9 @@ export type ResponseType = | 'document' | 'json' | 'text' - | 'stream' + | 'stream'; -export interface TransitionalOptions{ +export interface TransitionalOptions { silentJSONParsing: boolean; forcedJSONParsing: boolean; clarifyTimeoutError: boolean; @@ -77,11 +77,11 @@ export interface AxiosRequestConfig { proxy?: AxiosProxyConfig | false; cancelToken?: CancelToken; decompress?: boolean; - transitional?: TransitionalOptions + transitional?: TransitionalOptions; signal?: AbortSignal; } -export interface AxiosResponse { +export interface AxiosResponse { data: T; status: number; statusText: string; @@ -99,8 +99,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; @@ -131,7 +130,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; } @@ -167,7 +169,7 @@ export interface AxiosStatic extends AxiosInstance { isCancel(value: any): boolean; all(values: (T | Promise)[]): Promise; spread(callback: (...args: T[]) => R): (array: T[]) => R; - isAxiosError(payload: any): payload is AxiosError; + isAxiosError(payload: any): payload is AxiosError; } declare const axios: AxiosStatic;