// A tree node that contains children of the same type constTreeNode = ObjectType("TreeNode", { value:StringType(), children:ArrayType(SelfReferenceType()), });
// A linked list node constListNode = ObjectType("ListNode", { value:IntType(), next:OptionalType(SelfReferenceType()), });
Create a self-reference for recursive types.
Use this when a type needs to reference itself, such as tree structures or linked lists. The reference resolves to the containing named type.