global.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. PROD: any;
  44. DEV: boolean;
  45. __: unknown;
  46. }
  47. interface ImportMeta {
  48. readonly env: ImportMetaEnv;
  49. readonly glob: Function;
  50. }
  51. declare interface ViteEnv {
  52. VITE_PORT: number;
  53. VITE_USE_MOCK: boolean;
  54. VITE_PUBLIC_PATH: string;
  55. VITE_PROXY: [string, string][];
  56. VITE_GLOB_APP_TITLE: string;
  57. VITE_GLOB_APP_SHORT_NAME: string;
  58. VITE_USE_CDN: boolean;
  59. VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
  60. VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
  61. }
  62. declare function parseInt(s: string | number, radix?: number): number;
  63. declare function parseFloat(string: string | number): number;
  64. namespace JSX {
  65. // tslint:disable no-empty-interface
  66. type Element = VNode;
  67. // tslint:disable no-empty-interface
  68. type ElementClass = ComponentRenderProxy;
  69. interface ElementAttributesProperty {
  70. $props: any;
  71. }
  72. interface IntrinsicElements {
  73. [elem: string]: any;
  74. }
  75. interface IntrinsicAttributes {
  76. [elem: string]: any;
  77. }
  78. }
  79. }
  80. declare module 'vue' {
  81. export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
  82. }