(ref, types, seen = new Set())
| 389 | // Resolve a union member to its leaf record names, following nested unions and |
| 390 | // single-ref aliases. Every BiDi union bottoms out in records, so this is total. |
| 391 | function unionLeaves(ref, types, seen = new Set()) { |
| 392 | if (seen.has(ref)) return [] |
| 393 | seen.add(ref) |
| 394 | const t = types[ref] |
| 395 | if (!t) return [] |
| 396 | if (t.kind === 'record') return [ref] |
| 397 | if (t.kind === 'union') return t.variants.flatMap((v) => unionLeaves(v, types, seen)) |
| 398 | if (t.kind === 'alias' && t.type?.ref) return unionLeaves(t.type.ref, types, seen) |
| 399 | return [] |
| 400 | } |
| 401 | |
| 402 | // Whether a union variant is an object (record) type — following aliases and nested |
| 403 | // unions to their leaves. An enum, or an alias to a primitive/list/map (or an inline |
no test coverage detected