global.d.ts 2.1 KB

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