mobx-keystone-mindreframer
Version:
A MobX powered state management solution based on data trees with first class support for Typescript, snapshots, patches and much more
35 lines (34 loc) • 1.05 kB
TypeScript
/**
* Returns if the given function is a model flow or not.
*
* @param fn Function to check.
* @returns
*/
export declare function isModelFlow(fn: any): any;
/**
* Decorator that turns a function generator into a model flow.
*
* @param target
* @param propertyKey
* @param [baseDescriptor]
* @returns
*/
export declare function modelFlow(target: any, propertyKey: string, baseDescriptor?: PropertyDescriptor): void;
/**
* Tricks the TS compiler into thinking that a model flow generator function can be awaited
* (is a promise).
*
* @typeparam A Function arguments.
* @typeparam 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*.
*
* @typeparam T Promise return type.
* @param promise Promise.
* @returns
*/
export declare function _await<T>(promise: Promise<T>): Generator<Promise<T>, T, unknown>;