UNPKG

mobx-bonsai

Version:

A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding

21 lines (20 loc) 583 B
import { ParentPath } from './ParentPath'; /** * If the node has a parent it will return: * * ```ts * { * parent: parentObject, * path: "propertyName", * } * ``` * * If it has no parent (root node) it will return `undefined`. * * Note that this function will throw if the passed object is not a node. * * @template TParent Parent object type. * @param node Node to get the parent path from. * @returns Parent path or undefined if there's no parent. */ export declare function getParentPath<TParent extends object>(node: object): ParentPath<TParent> | undefined;