UNPKG

@equinor/fusion-observable

Version:
17 lines (16 loc) 694 B
import type { ActionCreator, ActionDefinitions, ActionTypes } from './types/actions'; /** flat map ActionDefinitions */ export type ActionCalls<T extends ActionDefinitions> = { [K in keyof T]: T[K] extends ActionCreator ? (...args: Parameters<T[K]>) => void : never; }; /** * Maps action definitions to a subject {@link FlowSubject} * * @param actions - object of named action * @param subject - target subject to map actions to * @returns object of callable action which maps to provided subject */ export declare const actionMapper: <T extends ActionDefinitions>(actions: T, subject: { next: (action: ActionTypes<T>) => void; }) => ActionCalls<T>; export default actionMapper;