提交 d07e648c 编写于 作者: E Evan Shortiss

Fixing type definitions so AxiosInstance can be invoked

上级 d7f021b8
......@@ -101,6 +101,8 @@ export interface AxiosInterceptorManager<V> {
}
export interface AxiosInstance {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
defaults: AxiosRequestConfig;
interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
......@@ -116,8 +118,6 @@ export interface AxiosInstance {
}
export interface AxiosStatic extends AxiosInstance {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
create(config?: AxiosRequestConfig): AxiosInstance;
Cancel: CancelStatic;
CancelToken: CancelTokenStatic;
......
......@@ -141,6 +141,10 @@ axios.patch<User>('/user', { foo: 'bar' })
const instance1: AxiosInstance = axios.create();
const instance2: AxiosInstance = axios.create(config);
instance1(config)
.then(handleResponse)
.catch(handleError);
instance1.request(config)
.then(handleResponse)
.catch(handleError);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册