@action-land/component
Version:
Basic interface for a component
22 lines (21 loc) • 1.19 kB
TypeScript
/**
* Created by tushar on 08/08/18
*/
import { Smitten } from '@action-land/smitten';
import { CommandFunction, ReducerFunction } from '@action-land/tarz';
/**
* Component interface.
*/
export declare class Component<S1, P1, I1 extends unknown[], V> {
readonly init: (...t: I1) => S1;
readonly update: ReducerFunction<S1>;
readonly command: CommandFunction<S1>;
readonly view: (e: Smitten, m: S1, p: P1) => V;
constructor(init: (...t: I1) => S1, update: ReducerFunction<S1>, command: CommandFunction<S1>, view: (e: Smitten, m: S1, p: P1) => V);
/**
* @deprecated Use Component.lift() instead
*/
map<S2, P2, I2 extends any[]>(fn: (component: Component<S1, P1, I1, V>) => Component<S2, P2, I2, V>): Component<S2, P2, I2, V>;
lift<S2, P2, I2 extends any[]>(fn: (component: Component<S1, P1, I1, V>) => Component<S2, P2, I2, V>): Component<S2, P2, I2, V>;
}
export declare const COM: <State, Params, Init extends any[], VNode>(init: (...t: Init) => State, update: ReducerFunction<State, any>, command: CommandFunction<State, any, any>, view: (e: Smitten<string | number>, m: State, p: Params) => VNode) => Component<State, Params, Init, VNode>;