当前位置:   article > 正文

解决在typescript里获取axios返回值报错的问题,Property ‘profile‘ does not exist on type ‘AxiosResponse<any>‘_argument of type '(response: axiosresponse) => axi

argument of type '(response: axiosresponse) => axiosresponse | und

如果你是用的vuecli创建的项目,那么请在res文件夹下新建axios.d.ts文件,添加以下内容:

/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
import * as axios from 'axios'

declare module 'axios' {
  interface AxiosInstance {
    (config: AxiosRequestConfig): Promise<any>
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

GitHub Issue

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/285722
推荐阅读
相关标签
  

闽ICP备14008679号