If they are going to contain only Node and derivatives, you may use Node. I think this is what you want type Node = ref object of RootObj id: string Container = ref object of Node scope: seq[Node] View = ref object of Node name: string initNode: Node scope: seq[Node]
This is an [example using your code](https://glot.io/snippets/eh6h4l1zvc)