TreeNode Class
A non-leaf SharedTree node. Includes objects, arrays, and maps.
Sealed
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export declare abstract class TreeNode implements WithType
Implements: WithType
Remarks
Base type which all nodes extend.
This type can be used as a type to indicate/document values which should be tree nodes. Runtime use of this class object (for example when used with instanceof or extending it), is not currently supported.
There are three ways to get instances of TreeNode:
- From a TreeView loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator. This case provides an InternalTreeNode to the constructor: subclasses must not modify how the constructor handles this case.
- Explicit construction of Unhydrated nodes using either TreeNodeSchemaClass as a constructor or TreeNodeSchemaNonClass.create. Either way the TreeNodeSchema produced must be produced using a SchemaFactory. There are also higher level APIs which wrap these, including create(schema, data), clone(node), and import APIs like importConcise(schema, data), importVerbose(schema, data, options), and importCompressed(schema, compressedData, options).
- Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead. These APIs internally call the constructor with the provided value (typically behaving like create(schema, data)), so it's really just a special case of the above option. Note that when constructing nodes, sometimes implicit construction is not allowed (either at runtime due to ambiguous types or at compile time due to TypeScript limitations): in such cases, explicit construction must be used. \