From 6c002323a6bf1efb66942cc130bd8d7cce212930 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Wed, 6 Oct 2021 20:13:06 +0200 Subject: [PATCH] Change never type to unknown (#4142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Distinguish request and response data types * Change never type to unknown Using `never` was a workaround I introduced in 3002, because `unknown` wasn’t supperted by all relevant versions of TypeScript at the time. It is now, and it is much more correct. Co-authored-by: Claas Augner Co-authored-by: Jay --- index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/index.d.ts b/index.d.ts index 27c3361..356508c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -81,7 +81,7 @@ export interface AxiosRequestConfig { signal?: AbortSignal; } -export interface AxiosResponse { +export interface AxiosResponse { data: T; status: number; statusText: string; @@ -90,7 +90,7 @@ export interface AxiosResponse { request?: any; } -export interface AxiosError extends Error { +export interface AxiosError extends Error { config: AxiosRequestConfig; code?: string; request?: any; @@ -99,7 +99,7 @@ export interface AxiosError extends Error { toJSON: () => object; } -export interface AxiosPromise extends Promise> { +export interface AxiosPromise extends Promise> { } export interface CancelStatic { @@ -143,14 +143,14 @@ 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 {