global.d.ts 2.4 KB

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