@epikodelabs/actionstack / Tree
Type Alias: Tree<LeafType, T>
Tree<
LeafType,T> ={ [K in keyof T]: T[K] extends object ? Tree<LeafType, T[K]> : LeafType }
Defined in: types.ts:301
Type alias representing a recursive tree structure.
This type is used to define nested objects in a hierarchical way.
LeafType: The type for the leaf nodes of the tree (representing the base values).T: Optional type parameter for the root object type (defaults toany).
The structure works as follows:
- For each property key
Kin the root object typeT:- If the property value
T[K]is an object:- The type for that property becomes another
Treeinstance, recursively defining the nested structure.
- The type for that property becomes another
- If the property value
T[K]is not an object:- The type for that property becomes the
LeafType.
- The type for that property becomes the
- If the property value
This type allows for representing complex object structures with nested objects and leaf nodes.
Type Parameters
LeafType
LeafType
T
T = any