/** * Configuration options for an action. * It can be used to configure the behavior of the useAction hook. */ export type ActionConfig = { /** Callback function to be called when an error occurs while executing the action. */ onError?: (err: Error) => void; /** Callback function to be called when the action is successful. */ onSuccess?: (data: ReturnOf) => void; }; type MultipleParams = T extends unknown[] ? T : [T]; type ActionFn = T extends (...args: infer Args) => Promise ? (...args: Args) => Promise : never; type ParamsOf = Parameters>; type ReturnOf = Awaited>>; /** * Hook to create an action from a namespace. * @internal * @param namespace - The namespace to create the action from. * @param fnName - The name of the action to create. Example: `Namespace.fnName` * @param config - Configuration options for the action. * @returns The action and its loading state. */ export declare const useAction: (namespace: Namespace | undefined, fnName: Key & string, config?: ActionConfig) => { /** The action to execute. */ action: (...args: MultipleParams>) => Promise>; /** The data returned by the action. */ data: Awaited>> | undefined; /** The error that occurred while executing the action. */ error: Error | undefined; /** Whether the action is pending. */ isPending: boolean; /** Whether the action is successful. */ isSuccess: boolean; /** Whether the action is in error. */ isError: boolean; }; export {}; //# sourceMappingURL=useAction.d.ts.map