From 2c9cc76ee9cce0a144a68d5a6b2b8f4da89c6e15 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Fri, 22 Oct 2021 09:14:23 +0100 Subject: [PATCH] revert: change type of AxiosResponse to any (#4186) * revert: change type of AxiosResponse to any * types: add back default types My bad xD * Remove redundant default params --- index.d.ts | 24 ++++++++++++------------ test/typescript/axios.ts | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/index.d.ts b/index.d.ts index 4255a72..804fc62 100644 --- a/index.d.ts +++ b/index.d.ts @@ -15,7 +15,7 @@ export interface AxiosResponseTransformer { } export interface AxiosAdapter { - (config: AxiosRequestConfig): AxiosPromise; + (config: AxiosRequestConfig): AxiosPromise; } export interface AxiosBasicCredentials { @@ -112,7 +112,7 @@ export interface AxiosDefaults extends Omit, 'hea headers: HeadersDefaults; } -export interface AxiosResponse { +export interface AxiosResponse { data: T; status: number; statusText: string; @@ -121,7 +121,7 @@ export interface AxiosResponse { request?: any; } -export interface AxiosError extends Error { +export interface AxiosError extends Error { config: AxiosRequestConfig; code?: string; request?: any; @@ -130,7 +130,7 @@ export interface AxiosError extends Error { toJSON: () => object; } -export interface AxiosPromise extends Promise> { +export interface AxiosPromise extends Promise> { } export interface CancelStatic { @@ -174,14 +174,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 { diff --git a/test/typescript/axios.ts b/test/typescript/axios.ts index 20cf058..16780f7 100644 --- a/test/typescript/axios.ts +++ b/test/typescript/axios.ts @@ -296,7 +296,7 @@ axios.interceptors.response.use((response: AxiosResponse) => Promise.resolve(res // Adapters const adapter: AxiosAdapter = (config: AxiosRequestConfig) => { - const response: AxiosResponse = { + const response: AxiosResponse = { data: { foo: 'bar' }, status: 200, statusText: 'OK',