mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Updated TypeScript typings with generic type parameters for request methods & AxiosResponse
This commit is contained in:
Vendored
+9
-9
@@ -3,7 +3,7 @@ export interface AxiosTransformer {
|
||||
}
|
||||
|
||||
export interface AxiosAdapter {
|
||||
(config: AxiosRequestConfig): AxiosPromise;
|
||||
(config: AxiosRequestConfig): AxiosPromise<any>;
|
||||
}
|
||||
|
||||
export interface AxiosBasicCredentials {
|
||||
@@ -44,8 +44,8 @@ export interface AxiosRequestConfig {
|
||||
cancelToken?: CancelToken;
|
||||
}
|
||||
|
||||
export interface AxiosResponse {
|
||||
data: any;
|
||||
export interface AxiosResponse<T = any> {
|
||||
data: T;
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: any;
|
||||
@@ -59,7 +59,7 @@ export interface AxiosError extends Error {
|
||||
response?: AxiosResponse;
|
||||
}
|
||||
|
||||
export interface AxiosPromise extends Promise<AxiosResponse> {
|
||||
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
|
||||
}
|
||||
|
||||
export interface CancelStatic {
|
||||
@@ -101,13 +101,13 @@ export interface AxiosInstance {
|
||||
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||
response: AxiosInterceptorManager<AxiosResponse>;
|
||||
};
|
||||
request(config: AxiosRequestConfig): AxiosPromise;
|
||||
get(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||
request<T = any>(config: AxiosRequestConfig): AxiosPromise<T>;
|
||||
get<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
|
||||
delete(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||
head(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||
post(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise;
|
||||
put(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise;
|
||||
patch(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise;
|
||||
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
|
||||
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
|
||||
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
|
||||
}
|
||||
|
||||
export interface AxiosStatic extends AxiosInstance {
|
||||
|
||||
Reference in New Issue
Block a user