hbus
Version:
An event bus lib.
8 lines (7 loc) • 467 B
TypeScript
export declare class Action<T = any, P = any> {
readonly type: T;
readonly payload?: Readonly<P> | undefined;
constructor(type: T, payload?: Readonly<P> | undefined);
}
export declare type ActionFactory<T = any, P = any> = (payload?: P) => Action<T, P>;
export declare function createActionFactory<T, P = any, DP extends (P extends object ? Partial<P> : P) = (P extends object ? Partial<P> : P)>(type: T, defaultPayload?: DP): ActionFactory<T, P>;