lucid-ui
Version:
A UI component library from Xandr.
44 lines • 1.85 kB
TypeScript
import _ from 'lodash';
export declare type Funk = (...args: any) => any;
export interface IThunk {
isThunk?: boolean;
}
export 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))[];
};
/**
* Checks the last element of the array and
* if it is an 'event' object, it removes it
* Otherwise it just returns the array
* @param {any[]} - an array of args
*/
export declare function cleanArgs(args: any[]): any[];
export {};
//# sourceMappingURL=redux.d.ts.map