global.d.ts 2.1 KB

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