Skip to main content

TreeObjectNode TypeAlias

A TreeNode which modules a JavaScript object.

Signature

export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;

Type Parameters

Parameter Constraint Default Description
T RestrictiveStringRecord<ImplicitFieldSchema>
TypeName string string

Remarks

Object nodes consist of a type which specifies which TreeNodeSchema they use (see schema(node)), and a collections of fields, each with a distinct key and its own FieldSchema defining what can be placed under that key.

All fields on an object node are exposed as own properties with string keys. Non-empty fields are enumerable and empty optional fields are non-enumerable own properties with the value undefined. No other own own or enumerable properties are included on object nodes unless the user of the node manually adds custom session only state. This allows a majority of general purpose JavaScript object processing operations (like for...in, Reflect.ownKeys() and Object.entries()) to enumerate all the children.