// 全局类型声明 // umi 模块声明补充 declare module 'umi' { export const history: { push: (path: string, state?: any) => void; replace: (path: string, state?: any) => void; go: (n: number) => void; goBack: () => void; goForward: () => void; location: { pathname: string; search: string; hash: string; state: any; }; listen: (listener: (location: any, action: string) => void) => () => void; }; export function useHistory(): typeof history; export function request(url: string, options?: { method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; params?: Record; data?: any; headers?: Record; [key: string]: any; }): Promise; export const Outlet: React.FC; export function useLocation(): { pathname: string; search: string; hash: string; state: any }; export function useParams(): T; } // CSS模块声明 declare module '*.css' { const content: any; export default content; } declare module '*.less' { const content: any; export default content; } // 图片资源声明 declare module '*.png' { const content: string; export default content; } declare module '*.jpg' { const content: string; export default content; } declare module '*.jpeg' { const content: string; export default content; } declare module '*.gif' { const content: string; export default content; } declare module '*.svg' { const content: string; export default content; } declare module '*.webp' { const content: string; export default content; } // Cesium相关声明 declare module 'cesium' { const content: any; export = content; } declare module 'cesium/Build/Cesium/Widgets/widgets.css'; // 扩展Window类型 interface Window { AMap: any; } // API 相关类型 declare namespace API { // 通用响应结构(兼容两种格式) interface Result { resp_code?: number; resp_msg?: string; code?: number; msg?: string; success?: boolean; data?: T; datas?: T; } // 分页响应结构(兼容两种格式) interface PageResult { resp_code?: number; resp_msg?: string; code?: number; msg?: string; success?: boolean; data?: T[]; datas?: T[]; count?: number; total?: number; totalCount?: number; } }