import { AsyncActionCreator } from "./makeAsyncActionCreator"; import { Reducer } from 'redux'; import { Action } from '.'; /** * Creates a reducer that handles action created with makeAsyncActionCreator() * * @template S The type of state consumed and produced by this reducer * * @template A The type of actions the reducer can potentially respond to. * * @param {AsyncActionCreator} actionCreator An action creator made with makeAsyncActionCreator * * @param {makeAsyncReducer.Options} [options] An object of options to define the * behavior of the reducer * * @returns {Reducer} A reducer function that builds a state object. */ export declare function makeAsyncReducer( actionCreator: AsyncActionCreator, options?: makeAsyncReducer.Options ): Reducer; export declare namespace makeAsyncReducer { export interface Options { dataProp?: string; shouldDestroyData?: boolean; shouldDestroyDataOnError?: boolean; shouldSetError?: boolean; defaultData?: any; shouldSpread?: boolean; shouldSetData?: boolean; dataGetter?: (state: S, action: A) => any; } export type makeAsyncReducerFactoryFN = ( actionCreator: AsyncActionCreator, options?: makeAsyncReducer.Options ) => Reducer /** * A factory function for creating a version of makeAsyncReducer * function with default options. * * @template S The type of state consumed and produced by this reducer * * @template A The type of actions the reducer can potentially respond to. * * @param {makeAsyncReducer.Options} defaults An object of options to * define the behavior of the reducer * * @returns {makeAsyncReducerFactoryFN} A makeAsyncReducer function with predefined options */ export function withDefaults( defaults: makeAsyncReducer.Options ): makeAsyncReducerFactoryFN } export default makeAsyncReducer;