UNPKG

mobx-state-tree

Version:

Opinionated, transactional, MobX powered state container

29 lines (28 loc) 934 B
import { IAnyType } from "../../internal"; /** @hidden */ declare const $stateTreeNodeType: unique symbol; /** * Common interface that represents a node instance. * @hidden */ export interface IStateTreeNode<IT extends IAnyType = IAnyType> { readonly [$stateTreeNodeType]?: [IT] | [any]; } /** @hidden */ export declare type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never; /** * Represents any state tree node instance. * @hidden */ export interface IAnyStateTreeNode extends IStateTreeNode<IAnyType> { } /** * Returns true if the given value is a node in a state tree. * More precisely, that is, if the value is an instance of a * `types.model`, `types.array` or `types.map`. * * @param value * @returns true if the value is a state tree node. */ export declare function isStateTreeNode<IT extends IAnyType = IAnyType>(value: any): value is IStateTreeNode<IT>; export {};