import React from 'react';
export declare type Reducer = (arg0: S, ...args: any[]) => S;
export declare type Reducers
= {
[K in keyof P]?: Reducer | Reducers
| Reducers
;
};
export declare type Selector = (arg0: S) => any;
export declare type Selectors
= {
[K in keyof P]?: (arg0: S) => any;
};
interface IStateOptions {
getState: () => S;
setState: (arg0: S) => void;
}
interface IBoundContext
{ getPropReplaceReducers(props: P): {} & S & P; getProps(props: P): {} & S & P; } interface IBuildHybridComponentOptions
{ replaceEvents?: boolean; reducers?: Reducers
; selectors?: Selectors
; } export declare function getDeepPaths(obj?: { [k: string]: any; } | null, path?: string[]): string[][]; export declare function isPlainObjectOrEsModule(obj: any): boolean; /** Recursively removes function type properties from obj */ export declare function omitFunctionPropsDeep
(obj?: object | P | null): { [k: string]: any; }; export declare function bindReducerToState
(reducerFunction: Reducer, { getState, setState }: IStateOptions, path?: string[]): ((...args: any[]) => void) & {
path: string[];
};
export declare function bindReducersToState
(reducers: Reducers
, { getState, setState }: IStateOptions): {};
export declare function getStatefulPropsContext
(reducers: Reducers
, { getState, setState }: IStateOptions): IBoundContext
;
/**
* reduceSelectors
*
* Generates a root selector from a tree of selectors
* @param {Object} selectors - a tree of selectors
* @returns {function} root selector that when called with state, calls each of
* the selectors in the tree with the state local to that selector.
*
* This function is memoized because it's recursive, and we want it to reuse
* the functions created in the recursive reduce because those functions are
* also memoized (reselect selectors are memoized with a cache of 1) and we want
* to maintain their caches.
*
* TODO: the types suck on this function but we spent a couple hours trying to
* get them to work and we couldn't figure out how to get generics to pass
* through _.memoize correctly. ¯\_(ツ)_/¯
*/
export declare const reduceSelectors: any;
export declare function safeMerge(objValue: any, srcValue: any): any[] | React.ReactElement {
reducers: Reducers ;
selectors: Selectors ;
peekDefaultProps: {
[key: string]: any;
};
}
export declare function buildModernHybridComponent (BaseComponent: React.ComponentType , { replaceEvents, reducers, selectors, }: IBuildHybridComponentOptions ): BaseType & IHybridComponent ;
export {};
//# sourceMappingURL=state-management.d.ts.map