UNPKG

992 BTypeScriptView Raw
1import { IAnyType, STNValue, Instance, IAnyComplexType } from "../../internal";
2/** @hidden */
3declare const $stateTreeNodeType: unique symbol;
4/**
5 * Common interface that represents a node instance.
6 * @hidden
7 */
8export interface IStateTreeNode<IT extends IAnyType = IAnyType> {
9 readonly [$stateTreeNodeType]?: [IT] | [any];
10}
11/** @hidden */
12export declare type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never;
13/**
14 * Represents any state tree node instance.
15 * @hidden
16 */
17export interface IAnyStateTreeNode extends STNValue<any, IAnyType> {
18}
19/**
20 * Returns true if the given value is a node in a state tree.
21 * More precisely, that is, if the value is an instance of a
22 * `types.model`, `types.array` or `types.map`.
23 *
24 * @param value
25 * @returns true if the value is a state tree node.
26 */
27export declare function isStateTreeNode<IT extends IAnyComplexType = IAnyComplexType>(value: any): value is STNValue<Instance<IT>, IT>;
28export {};