import type { Draft } from 'immer'; interface BaseAction { onError?: (info: { error: E; arg: Arg; }) => void; onSuccess?: (info: { data: D; arg: Arg; }) => void; } export interface NormalAction extends BaseAction { fetchData: (arg: Arg) => Promise; syncState: (draft: Draft, payload: { startAt: number; arg: Arg; data: Data; }) => void; } export interface InfiniteAction extends BaseAction { fetchData: (arg: Arg, meta: { previousData: Data | null; pageIndex: number; }) => Promise; syncState: (draft: Draft, payload: { data: Data; arg: Arg; pageSize: number; pageIndex: number; }) => void; } export type Action = NormalAction | InfiniteAction; export type Listener = () => void; export {};