global.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 AxiosHeaders =
  14. | 'application/json'
  15. | 'application/x-www-form-urlencoded'
  16. | 'multipart/form-data'
  17. declare type AxiosMethod = 'get' | 'post' | 'delete' | 'put'
  18. declare type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  19. declare interface AxiosConfig {
  20. params?: any
  21. data?: any
  22. url?: string
  23. method?: AxiosMethod
  24. headersType?: string
  25. responseType?: AxiosResponseType
  26. }
  27. declare interface IResponse<T = any> {
  28. code: string
  29. data: T extends any ? T : T & any
  30. }
  31. }