Packages > @fluidframework/tree > WithType

WithType Interface

Adds a type field.

Signature

export interface WithType<TName extends string = string>

Type Parameters

Parameter Constraint Default Description
TName string string

Properties

Property Modifiers Type Description
[type] readonly TName The type of a TreeNode. For moore information about the type, use Tree.schema(theNode) instead.

Property Details

[type]

The type of a TreeNode . For moore information about the type, use Tree.schema(theNode) instead.

Signature

get [type](): TName;

Remarks

This symbol mainly exists on nodes to allow TypeScript to provide more accurate type checking. Tree.is and Tree.schema provide a superset of this information in more friendly ways.

This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected. Instead construct a real node of the desired type using its constructor.