export function* recursiveIterator(obj: { children: any; }): IterableIterator { yield obj; for (const child of obj.children) { yield* recursiveIterator(child); } }