env.d.ts
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// / <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue';
const component: DefineComponent<{}, {}, any>;
export default component;
}
interface ImportMetaEnv {
readonly VITE_API_BASE_URL?: string;
// 在这里添加更多环境变量类型定义
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
// declare module 手动提供模块类型定义,避免异常
declare module 'glsk-common' {
export interface HttpConfig {
response?: any;
request?: any;
sign?: any;
secret?: any;
alert?: (message: string) => void;
}
export class Http {
[key: string]: any;
constructor(config: HttpConfig);
}
}
declare module 'glsk-toolkit' {
export class Request {
[key: string]: any;
constructor(config: any);
delete(url: string, config?: any): Promise<any>;
get(url: string, config?: any): Promise<any>;
post(url: string, data?: any, config?: any): Promise<any>;
put(url: string, data?: any, config?: any): Promise<any>;
}
}
// 扩展 Window 接口,添加全局属性类型定义
declare global {
interface Window {
$fetchConfig?: any; // 配置中心返回的配置数据
/** @deprecated 已废弃,请使用 getGscApi() 从 '@/config/center' 获取实例 */
$gscApi?: any; // glsk-toolkit Request 实例(已废弃,使用模块级单例替代)
}
}
// 确保这是一个模块
export {};