global.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. declare type TimeoutHandle = ReturnType<typeof setTimeout>
  12. declare type IntervalHandle = ReturnType<typeof setInterval>
  13. type AxiosHeaders =
  14. | 'application/json'
  15. | 'application/x-www-form-urlencoded'
  16. | 'multipart/form-data'
  17. type AxiosMethod = 'get' | 'post' | 'delete' | 'put' | 'GET' | 'POST' | 'DELETE' | 'PUT'
  18. type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  19. interface AxiosConfig {
  20. params?: any
  21. data?: any
  22. url?: string
  23. method?: AxiosMethod
  24. headersType?: string
  25. responseType?: AxiosResponseType
  26. }
  27. interface IResponse<T = any> {
  28. code: string
  29. data: T extends any ? T : T & any
  30. }
  31. interface PageParam {
  32. pageSize?: number
  33. pageNo?: number
  34. }
  35. interface Tree {
  36. id: number
  37. name: string
  38. children?: Tree[] | any[]
  39. }
  40. }