global.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import type { ComponentRenderProxy, PropType as VuePropType, VNode } from "vue";
  2. // GlobalComponents for Volar
  3. declare module "vue" {
  4. export interface GlobalComponents {}
  5. }
  6. declare global {
  7. const __APP_INFO__: {
  8. pkg: {
  9. name: string;
  10. version: string;
  11. dependencies: Recordable<string>;
  12. devDependencies: Recordable<string>;
  13. };
  14. lastBuildTime: string;
  15. };
  16. interface Window {
  17. // Global vue app instance
  18. __APP__: App<Element>;
  19. webkitCancelAnimationFrame: (handle: number) => void;
  20. mozCancelAnimationFrame: (handle: number) => void;
  21. oCancelAnimationFrame: (handle: number) => void;
  22. msCancelAnimationFrame: (handle: number) => void;
  23. webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  24. mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  25. oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  26. msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  27. }
  28. // vue
  29. type PropType<T> = VuePropType<T>;
  30. type Writable<T> = {
  31. -readonly [P in keyof T]: T[P];
  32. };
  33. type Nullable<T> = T | null;
  34. type NonNullable<T> = T extends null | undefined ? never : T;
  35. type Recordable<T = any> = Record<string, T>;
  36. type ReadonlyRecordable<T = any> = {
  37. readonly [key: string]: T;
  38. };
  39. type Indexable<T = any> = {
  40. [key: string]: T;
  41. };
  42. type DeepPartial<T> = {
  43. [P in keyof T]?: DeepPartial<T[P]>;
  44. };
  45. type TimeoutHandle = ReturnType<typeof setTimeout>;
  46. type IntervalHandle = ReturnType<typeof setInterval>;
  47. interface ChangeEvent extends Event {
  48. target: HTMLInputElement;
  49. }
  50. interface WheelEvent {
  51. path?: EventTarget[];
  52. }
  53. // 环境变量 字面值
  54. declare type ModeString = "dev" | "test" | "staging" | "online";
  55. declare type option = {
  56. label: any;
  57. value: any;
  58. };
  59. declare type options = option[];
  60. declare interface ViteEnv {
  61. VITE_PORT: number;
  62. VITE_PUBLIC_PATH: string;
  63. VITE_PROXY_DOMAIN: string;
  64. VITE_PROXY_DOMAIN_REAL: string;
  65. VITE_PROXY_CDN: string;
  66. VITE_PROXY_CDN_REAL: string;
  67. VITE_ROUTER_HISTORY: string;
  68. }
  69. declare interface ServerConfigs {
  70. Version?: string;
  71. Title?: string;
  72. FixedHeader?: boolean;
  73. HiddenSideBar?: boolean;
  74. KeepAlive?: boolean;
  75. Locale?: string;
  76. Layout?: string;
  77. Theme?: string;
  78. DarkMode?: boolean;
  79. Grey?: boolean;
  80. Weak?: boolean;
  81. HideTabs?: boolean;
  82. SidebarStatus?: boolean;
  83. EpThemeColor?: string;
  84. ShowLogo?: boolean;
  85. ShowModel?: string;
  86. MapConfigure?: {
  87. amapKey?: string;
  88. options: {
  89. resizeEnable?: boolean;
  90. center?: number[];
  91. zoom?: number;
  92. };
  93. };
  94. }
  95. function parseInt(s: string | number, radix?: number): number;
  96. function parseFloat(string: string | number): number;
  97. namespace JSX {
  98. // tslint:disable no-empty-interface
  99. type Element = VNode;
  100. // tslint:disable no-empty-interface
  101. type ElementClass = ComponentRenderProxy;
  102. interface ElementAttributesProperty {
  103. $props: any;
  104. }
  105. interface IntrinsicElements {
  106. [elem: string]: any;
  107. }
  108. interface IntrinsicAttributes {
  109. [elem: string]: any;
  110. }
  111. }
  112. }