overmind
Version:
Frictionless state management
1 lines • 1.41 kB
Source Map (JSON)
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGrC;GACG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA","sourcesContent":["import { ResolveAction, ContextFunction } from './internalTypes'\nimport { IS_OPERATOR } from './utils'\nimport { IMutationCallback, IFlushCallback } from 'proxy-state-tree'\n\n/** ===== PUBLIC API\n */\nexport { EventType } from './internalTypes'\n\nexport type IConfiguration = {\n state?: {}\n effects?: {}\n actions?: {}\n}\n\nexport type IState = {\n [key: string]: IState | string | number | boolean | object | null | undefined\n}\n\nexport type IContext<T extends IConfiguration> = {\n state: T['state']\n actions: { [K in keyof T['actions']]: ResolveAction<T['actions'][K]> }\n effects: T['effects']\n reaction: IReaction<{ state: T['state'] }>\n addMutationListener: (cb: IMutationCallback) => () => void\n addFlushListener: (cb: IFlushCallback) => () => void\n}\n\nexport interface IAction<I, O> extends ContextFunction<I, O> {}\n\nexport interface IOperator<I, O> extends ContextFunction<I, O> {\n [IS_OPERATOR]: true\n}\n\nexport interface IReaction<T extends { state?: IState }> {\n <O>(\n stateCallback: (state: T['state']) => O,\n updateCallback: (value: O) => void,\n options?: {\n nested?: boolean\n immediate?: boolean\n }\n ): () => void\n}\n"]}