global.d.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import type {
  2. ComponentRenderProxy,
  3. VNode,
  4. VNodeChild,
  5. ComponentPublicInstance,
  6. FunctionalComponent,
  7. PropType as VuePropType,
  8. } from 'vue';
  9. declare global {
  10. const __APP_INFO__: {
  11. pkg: {
  12. name: string;
  13. version: string;
  14. dependencies: Recordable<string>;
  15. devDependencies: Recordable<string>;
  16. };
  17. lastBuildTime: string;
  18. };
  19. // declare interface Window {
  20. // // Global vue app instance
  21. // __APP__: App<Element>;
  22. // }
  23. // vue
  24. declare type PropType<T> = VuePropType<T>;
  25. declare type VueNode = VNodeChild | JSX.Element;
  26. export type Writable<T> = {
  27. -readonly [P in keyof T]: T[P];
  28. };
  29. declare type Nullable<T> = T | null;
  30. declare type NonNullable<T> = T extends null | undefined ? never : T;
  31. declare type Recordable<T = any> = Record<string, T>;
  32. declare type ReadonlyRecordable<T = any> = {
  33. readonly [key: string]: T;
  34. };
  35. declare type Indexable<T = any> = {
  36. [key: string]: T;
  37. };
  38. declare type DeepPartial<T> = {
  39. [P in keyof T]?: DeepPartial<T[P]>;
  40. };
  41. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  42. declare type IntervalHandle = ReturnType<typeof setInterval>;
  43. declare interface ChangeEvent extends Event {
  44. target: HTMLInputElement;
  45. }
  46. declare interface WheelEvent {
  47. path?: EventTarget[];
  48. }
  49. interface ImportMetaEnv extends ViteEnv {
  50. __: unknown;
  51. }
  52. declare interface ViteEnv {
  53. VITE_PORT: number;
  54. VITE_GLOB_USE_MOCK: boolean;
  55. VITE_USE_PWA: boolean;
  56. VITE_GLOB_PUBLIC_PATH: string;
  57. VITE_PROXY: [string, string][];
  58. VITE_GLOB_APP_TITLE: string;
  59. VITE_GLOB_APP_SHORT_NAME: string;
  60. VITE_USE_CDN: boolean;
  61. VITE_GLOB_DROP_CONSOLE: boolean;
  62. VITE_GLOB_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
  63. VITE_GLOB_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
  64. VITE_LEGACY: boolean;
  65. VITE_GLOB_USE_IMAGEMIN: boolean;
  66. VITE_GENERATE_UI: string;
  67. VITE_GLOB_CONTENT_SECURITY_POLICY: boolean;
  68. VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number;
  69. VITE_GLOB_ALARM_NOTIFY_DURATION: number;
  70. }
  71. declare function parseInt(s: string | number, radix?: number): number;
  72. declare function parseFloat(string: string | number): number;
  73. namespace JSX {
  74. // tslint:disable no-empty-interface
  75. type Element = VNode;
  76. // tslint:disable no-empty-interface
  77. type ElementClass = ComponentRenderProxy;
  78. interface ElementAttributesProperty {
  79. $props: any;
  80. }
  81. interface IntrinsicElements {
  82. [elem: string]: any;
  83. }
  84. interface IntrinsicAttributes {
  85. [elem: string]: any;
  86. }
  87. }
  88. }
  89. declare module 'vue' {
  90. export type JSXComponent<Props = any> =
  91. | { new (): ComponentPublicInstance<Props> }
  92. | FunctionalComponent<Props>;
  93. }