Packages > @fluidframework/tree > TreeNodeSchemaClass

TreeNodeSchemaClass Interface

Tree node schema which is implemented using a class.

Signature

export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info>

Extends: TreeNodeSchemaCore <Name, Kind, ImplicitlyConstructable, Info>

Type Parameters

Parameter Constraint Default Description
Name string string
Kind NodeKind NodeKind
TNode unknown
TInsertable never
ImplicitlyConstructable boolean boolean
Info unknown

Remarks

Instances of this class are nodes in the tree. This is also a constructor so that it can be subclassed.

Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way. Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer “any” in the d.ts file.

Construct Signatures

ConstructSignature Modifiers Return Type Description
new (data: TInsertable): Unhydrated<TNode> sealed Unhydrated<TNode> Constructs an Unhydrated node with this schema.

Construct Signature Details

new (data: TInsertable): Unhydrated<TNode>

Constructs an Unhydrated node with this schema.

Signature

/** @sealed */
new (data: TInsertable): Unhydrated<TNode>;

Remarks

This constructor is also used internally to construct hydrated nodes with a different parameter type. Therefor overriding this constructor is not type-safe and is not supported.

Parameters

Parameter Type Description
data TInsertable

Returns

Return type: Unhydrated <TNode>