global.d.ts 2.5 KB

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