3
0

global.d.ts 2.5 KB

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