UNPKG

@ui-schema/react

Version:

Schema-driven UI generator for React using JSON Schema. Build powerful form and interface generators with headless components and hooks.

14 lines (13 loc) 1.04 kB
import { UIStoreType } from '@ui-schema/react/UIStore'; import { UIStoreActions, UIStoreUpdaterData } from '@ui-schema/react/UIStoreActions'; type StoreActionHandlersMap<S extends UIStoreType = UIStoreType, D extends UIStoreUpdaterData = UIStoreUpdaterData, TActions extends UIStoreActions<S, D> = UIStoreActions<S, D>> = { [Type in TActions['type']]?: (store: S, action: Extract<TActions, { type: Type; }>) => S; }; /** * @todo simplify generics, can be done after the deprecated `effects` option is removed from actions in a future version */ export declare const createActionsReducer: <S extends UIStoreType = UIStoreType, D extends UIStoreUpdaterData = UIStoreUpdaterData, A extends UIStoreActions<S, D> = UIStoreActions<S, D>>(handlersMap: StoreActionHandlersMap<S, D, A>) => (actions: A[] | A) => (oldStore: S) => S; export declare const storeUpdater: (actions: UIStoreActions<UIStoreType, UIStoreUpdaterData> | UIStoreActions<UIStoreType, UIStoreUpdaterData>[]) => (oldStore: UIStoreType) => UIStoreType; export {};