Represents a generic tree node structure used in SubtreeHooks. This interface is intended to be extended to define your own custom tree shape.
SubtreeHooks
import { Node } from 'subtree-hooks';interface MyNode extends Node<MyNode> { // Some custom property for directories or files prop1: string; prop2: string;}const myNode: MyNode = { prop1: "rootProp1", prop2: "rootProp2", files: { "file1.txt": { prop1: "child1", prop2: "child2" } }}; Copy
import { Node } from 'subtree-hooks';interface MyNode extends Node<MyNode> { // Some custom property for directories or files prop1: string; prop2: string;}const myNode: MyNode = { prop1: "rootProp1", prop2: "rootProp2", files: { "file1.txt": { prop1: "child1", prop2: "child2" } }};
The specific shape of your custom tree. This allows recursive typing so that child nodes have the same type.
Optional
Child files or directories in this node. Each key is the file or directory name, and the value is a sub-node of type CustomNode.
CustomNode
Represents a generic tree node structure used in
SubtreeHooks. This interface is intended to be extended to define your own custom tree shape.Example