global.d.ts 1.1 KB

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