Skip to main content

TreeNodeSchema TypeAlias

Schema for a TreeNode or TreeLeafValue.

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 type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;

Type Parameters

Parameter Constraint Default Description
Name string string The full (including scope) name/identifier for the schema.
Kind NodeKind NodeKind Which kind of node this schema is for.
TNode TreeNode | TreeLeafValue TreeNode | TreeLeafValue API for nodes that use this schema.
TBuild never Data which can be used to construct an Unhydrated node of this type.
ImplicitlyConstructable boolean boolean
Info unknown Data used when defining this schema.
TCustomMetadata unknown

Remarks

Captures the schema both as runtime data and compile time type information. Use SchemaFactory to define schema. Use Tree.schema(value) to lookup the schema for a TreeNode or TreeLeafValue.