global.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 type PropType<T> = VuePropType<T>
  13. declare type VueNode = VNodeChild | JSX.Element
  14. declare type Nullable<T> = T | null
  15. declare type Recordable<T = any> = Record<string, T>
  16. interface ImportMetaEnv extends ViteEnv {
  17. __: unknown
  18. }
  19. declare interface ViteEnv {
  20. VITE_PORT: number // 端口
  21. VITE_ROUTER_MODE: 'history' | 'hash' // 路由模式
  22. VITE_PROXY: [string, string][] // 本地代理配置
  23. VITE_DROP_CONSOLE: boolean // 删除日志
  24. VITE_USE_MOCK: boolean
  25. VITE_USE_GZIP: boolean
  26. VITE_USE_PWA: boolean
  27. VITE_PUBLIC_PATH: string
  28. VITE_GLOB_APP_TITLE: string
  29. VITE_GLOB_APP_SHORT_NAME: string
  30. VITE_USE_CDN: boolean
  31. VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
  32. VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
  33. VITE_LEGACY: boolean
  34. VITE_USE_IMAGEMIN: boolean
  35. VITE_GENERATE_UI: string
  36. }
  37. namespace JSX {
  38. // tslint:disable no-empty-interface
  39. type Element = VNode
  40. // tslint:disable no-empty-interface
  41. type ElementClass = ComponentRenderProxy
  42. interface ElementAttributesProperty {
  43. $props: any
  44. }
  45. interface IntrinsicElements {
  46. [elem: string]: any
  47. }
  48. interface IntrinsicAttributes {
  49. [elem: string]: any
  50. }
  51. }
  52. }
  53. declare module 'vue' {
  54. export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>
  55. }