global.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import type { CSSProperties } from 'vue'
  2. declare global {
  3. declare interface Fn<T = any> {
  4. (...arg: T[]): T
  5. }
  6. declare type Nullable<T> = T | null
  7. declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
  8. declare type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
  9. declare type ComponentRef<T> = InstanceType<T>
  10. declare type LocaleType = 'zh-CN' | 'en'
  11. declare type TimeoutHandle = ReturnType<typeof setTimeout>
  12. declare type IntervalHandle = ReturnType<typeof setInterval>
  13. declare type ElementPlusSize = 'default' | 'small' | 'large'
  14. declare type ElementPlusInfoType = 'success' | 'info' | 'warning' | 'danger'
  15. declare type LayoutType = 'classic' | 'topLeft' | 'top' | 'cutMenu'
  16. declare type AxiosHeaders =
  17. | 'application/json'
  18. | 'application/x-www-form-urlencoded'
  19. | 'multipart/form-data'
  20. declare type AxiosMethod = 'get' | 'post' | 'delete' | 'put'
  21. declare type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  22. declare interface AxiosConfig {
  23. params?: any
  24. data?: any
  25. url?: string
  26. method?: AxiosMethod
  27. headersType?: string
  28. responseType?: AxiosResponseType
  29. }
  30. declare interface IResponse<T = any> {
  31. code: string
  32. data: T extends any ? T : T & any
  33. }
  34. }