Replies: 2 comments 1 reply
-
扩大模块声明的方式可参考文档:Module Augmentation 简而言之,你需要在扩大 interface 之前先引入这个类型 import type { MethodRequestConfig } from "alova";
declare module 'alova' {
interface MethodRequestConfig {
//自定义处理异常,传True是不显示ElMessage
customCatch?: boolean;
responseType?: string;
}
} 应该会帮到你。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@MeetinaXD 主要的问题是使用Axios适配器Config参数没有AxiosRequestConfig的类型提示,我是使用alova插件自动生成的OpenApi接口,declare module只是我的一个用例想自己补充一下缺少提示的问题,暂时不用管declare module |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
使用Fetch时还能定义模块,像这样
使用axios适配器后连这个定义也失效,没有任何TS智能提示
Beta Was this translation helpful? Give feedback.
All reactions