[Home](../../readme.md) | [Installation](../installation.md) | [Usage](../usage.md) | **Types** | [Values](../values/) | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md) # Recursive Types Use the Recursive function to create recursive types. ```typescript const Node = Type.Recursive( (This) => Type.Object({ // const Node = { id: Type.String(), // $id: 'Node', nodes: Type.Array(This), // type: 'object', }), { $id: "Node" } ); // properties: { // id: { // type: 'string' // }, // nodes: { // type: 'array', // items: { // $ref: 'Node' // } // } // }, // required: [ // 'id', // 'nodes' // ] // } type Node = Static; // type Node = { // id: string // nodes: Node[] // } function test(node: Node) { const id = node.nodes[0].nodes[0].id; // id is string } ``` Back to [Home](../../readme.md)