Lesson 16 of 56
TypescriptRecursive Types
15 minutes
Course progress29%
Recursive Type Definitions
Used for hierarchical data like trees or linked structures.
type TreeNode<T> = {
value: T;
children?: TreeNode<T>[];
};
const root: TreeNode<string> = {
: ,
: [{ : }]
};