alova.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'alova';
  2. declare module 'alova' {
  3. export interface AlovaCustomTypes {
  4. meta: {
  5. /* eslint-disable perfectionist/sort-object-types, perfectionist/sort-union-types -- meta 按业务语义分组;联合类型按解析层级 raw → body → data */
  6. /** Token 认证拦截器 */
  7. authRole?: 'login' | 'logout' | 'none' | 'refreshToken';
  8. login?: true;
  9. logout?: true;
  10. refreshToken?: true;
  11. visitor?: true;
  12. /**
  13. * 响应解析层级
  14. * - raw = Response
  15. * - body = 已解析 body
  16. * - data = envelope 解包后的 data(默认)
  17. * - fn = 自定义,再进入 unwrap
  18. */
  19. parseResponse?:
  20. | 'raw'
  21. | 'body'
  22. | 'data'
  23. | (<R>(
  24. body: unknown,
  25. response: Response,
  26. method: import('alova').Method,
  27. ) => R & {
  28. __skip_unwrap_?: true;
  29. });
  30. ignoreError?: boolean;
  31. disposeError?: 'ignore' | 'message' | 'notification' | 'modal';
  32. /* eslint-enable perfectionist/sort-object-types, perfectionist/sort-union-types */
  33. };
  34. }
  35. }