findRoot<T extends AbsNodeType> function

TreeType<T> findRoot<T extends AbsNodeType>(
  1. TreeType<T> tree
)

Implementation

TreeType<T> findRoot<T extends AbsNodeType>(TreeType<T> tree) {
  if (tree.isRoot) return tree;
  return findRoot(tree.parent!);
}