mobx-bonsai
Version:
A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding
11 lines (10 loc) • 374 B
TypeScript
/**
* Returns the root node, this is, will follow the tree up to the node with no parent and will return it.
*
* Note that this function will throw if the passed object is not a node.
*
* @template TRoot Root object type.
* @param node Node to get the root from.
* @returns Root object.
*/
export declare function getRoot<TRoot extends object>(node: object): TRoot;