TS:Property ‘success‘ does not exist on type ‘AxiosResponse<any>‘.Vetur(2339)

由于 AxiosResponse上并没有自己规定返回的一些字段,没有会出现这个波浪
src文件下创建一个axios.d.ts文件:

import * as axios from 'axios'

declare module 'axios' {
  interface AxiosInstance {
    (config: AxiosRequestConfig): Promise<any>
  }
}

如果没有还是提示,重启一下ide

上一篇:Property ‘payload‘ does not exist on type ‘AxiosResponse<any>‘. 问题解决


下一篇:Chrome报错:Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.