UNPKG

mobx-keystone

Version:

A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more

32 lines (31 loc) 994 B
declare const modelFlowSymbol: unique symbol; /** * Returns if the given function is a model flow or not. * * @param fn Function to check. * @returns */ export declare function isModelFlow(fn: unknown): fn is Function & Record<typeof modelFlowSymbol, unknown>; /** * Decorator that turns a function generator into a model flow. */ export declare function modelFlow(...args: any[]): void; /** * Tricks the TS compiler into thinking that a model flow generator function can be awaited * (is a promise). * * @template A Function arguments. * @template R Return value. * @param fn Flow function. * @returns */ export declare function _async<A extends any[], R>(fn: (...args: A) => Generator<any, R, any>): (...args: A) => Promise<R>; /** * Makes a promise a flow, so it can be awaited with yield*. * * @template T Promise return type. * @param promise Promise. * @returns */ export declare function _await<T>(promise: Promise<T>): Generator<Promise<T>, T, unknown>; export {};