env.d.ts 1.4 KB
// / <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 {};