ipreact
Version:
connect data-actions of preact-components via immutablejs
21 lines (20 loc) • 698 B
TypeScript
import { ComponentFactory } from "preact";
export interface DispatchAction<T> {
(action: {
(state: T): T;
}, props?: any): void;
}
export interface Middleware<T> {
(state: T, nextState: T, props?: any): void;
}
export declare type Connect<T> = (mapProps?: (props: T) => T, mapDispatch?: (props: T) => T) => (com: ComponentFactory<T>) => ComponentFactory<T>;
export interface IPreact<T> {
getState: {
(): T;
};
dispatch: DispatchAction<T>;
connect: Connect<any>;
}
export declare const isSameObject: (obj1: any, obj2: any) => boolean;
declare const _default: (middlewares?: Middleware<any>[]) => (initState?: {}) => IPreact<any>;
export default _default;