typedux
Version:
Slightly adjusted Redux (awesome by default) for TS
35 lines (34 loc) • 1.09 kB
TypeScript
import type { ILeafReducer } from './LeafReducer';
import type { ActionMessage } from '../actions';
import type { StateConstructor, State } from "./State";
/**
* Leaf reducer
*/
export declare class DefaultLeafReducer<K extends string, S extends State<K>, StateType extends StateConstructor<S>, A extends ActionMessage<S>> implements ILeafReducer<S, A> {
private _leaf;
private _stateType;
/**
* Inflate from js
*
* @param stateType
* @param o
* @returns {any}
*/
static stateFromJS<S>(stateType: {
new (): S;
}, o: any): S;
/**
* Create a new leaf reducer
*
* @param leaf
* @param stateType
* @returns {AnonLeafReducer}
*/
static create<K extends string, S extends State<K>, StateType extends StateConstructor<S>>(leaf: string, stateType: StateType): DefaultLeafReducer<K, S, StateType, ActionMessage<S>>;
constructor(_leaf: string, _stateType: StateType);
stateType(): StateType;
leaf(): string;
defaultState(o: any): S;
equals(o: any): boolean;
valueOf(): string;
}