lucid-ui
Version:
A UI component library from AppNexus.
38 lines • 1.65 kB
TypeScript
import _ from 'lodash';
declare type Funk = (...args: any) => any;
interface IThunk {
isThunk?: boolean;
}
declare type FunkThunk = Funk & IThunk;
/**
* Marks a function on the reducer tree as a thunk action creator so it doesn't
* get incorporated into the redux reducer
*
* @return {function} with `isThunk` set to `true`
*/
export declare function thunk(fn: FunkThunk): FunkThunk;
/**
* Creates a redux reducer and connectors (inputs to redux-react's `connect`)
*
* @param {Object} param
* @param {Object} param.initialState - the initial state object that the reducer will return
* @param {Object} param.reducers - a tree of lucid reducers
* @param {string[]} param.rootPath - array of strings representing the path to local state in global state
* @param {function} param.rootSelector - a top-level selector which takes as input state that has run through every selector in param.selectors
* @param {Object} param.selectors - a tree of lucid selectors
* @return {Object} redux reducer and connectors
*/
interface IGetReduxPrimitives {
initialState: object;
reducers: object;
rootPath?: string[];
rootSelector?: (arg0: any) => any;
selectors?: object;
}
export declare function getReduxPrimitives({ initialState, reducers, rootPath, rootSelector, selectors, }: IGetReduxPrimitives): {
reducer: (state: any, action: object) => object | Funk;
connectors: (((dispatch: Funk) => object) | ((rootState: object) => any) | (((state: any, dispatchTree: any, ownProps: any) => any) & _.MemoizedFunction))[];
};
export declare function cleanArgs(args: any[]): any[];
export {};
//# sourceMappingURL=redux.d.ts.map