Skip to main content

TreeNodeSchema TypeAlias

Schema for a TreeNode or TreeLeafValue.

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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;

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.

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.