Property ‘errorCode‘ does not exist on type ‘AxiosResponse<any, any>‘.ts(2339)
故事比较简单,在axios返回结果中存在默认字段之外的字段,于是就出现了警告。AxiosResponse默认字段如下:export interface AxiosResponse<T = any, D = any>{data: T;status: number;statusText: string;headers: AxiosResponseHeaders;config: AxiosR
·
故事比较简单,在axios
返回结果中存在默认字段之外的字段,于是就出现了警告。
AxiosResponse
默认字段如下:
export interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: AxiosResponseHeaders;
config: AxiosRequestConfig<D>;
request?: any;
}
众里寻他,在axios
中发现了这个:issue传送门
I override AxiosResponse in my axios.d.ts:
import axios from 'axios'
declare module 'axios' {
export interface AxiosResponse<T = any> extends Promise<T> {}
}
于是……,世界都清爽了好多
更多推荐
所有评论(0)