global.d.ts 2.2 KB

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