ts 模块声明导致 axios 功能不能使用?-灵析社区

文文问问

ts 中为 axios 的 config 属性约束新增自定义属性,导致 axios 其他工具函数报错,报错信息如下:Property 'get' does not exist on type 'typeof import("axios")'. module 'axios' { declare interface AxiosRequestConfig { timestramp: number; } } import axios, { AxiosRequestConfig } from 'axios'; axios.get() 查了一下是因为 axios 模块声明导致 axios 模块被覆盖,请问这种问题该如何解决呢

阅读量:46

点赞量:0

问AI
云端小仙女
加个"export * from 'axios';" e.g. «index.d.ts» export * from 'axios'; module 'axios' { interface AxiosRequestConfig { timestramp: number; } }