global.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. export {}
  2. declare global {
  3. interface Fn<T = any> {
  4. (...arg: T[]): T
  5. }
  6. type Nullable<T> = T | null
  7. type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
  8. type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
  9. type ComponentRef<T> = InstanceType<T>
  10. type LocaleType = 'zh-CN' | 'en'
  11. type AxiosHeaders =
  12. | 'application/json'
  13. | 'application/x-www-form-urlencoded'
  14. | 'multipart/form-data'
  15. type AxiosMethod =
  16. | 'get'
  17. | 'post'
  18. | 'delete'
  19. | 'put'
  20. | 'patch'
  21. | 'GET'
  22. | 'POST'
  23. | 'DELETE'
  24. | 'PUT'
  25. | 'PATCH'
  26. type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  27. interface AxiosConfig {
  28. params?: any
  29. data?: any
  30. url?: string
  31. method?: AxiosMethod
  32. headersType?: string
  33. responseType?: AxiosResponseType
  34. }
  35. interface IResponse<T = any> {
  36. code: string
  37. data: T extends any ? T : T & any
  38. }
  39. interface PageParam {
  40. pageSize?: number
  41. pageNo?: number
  42. }
  43. interface Tree {
  44. id: number
  45. name: string
  46. children?: Tree[] | any[]
  47. }
  48. }