( node: BaseRoot, entry: DisjointEntry, depth: number, check: UndeclaredKeyCheck )
| 2800 | // follows an entry's path through the props a node declares to the first key it |
| 2801 | // doesn't, where check decides |
| 2802 | const entryAtUndeclaredKey = ( |
| 2803 | node: BaseRoot, |
| 2804 | entry: DisjointEntry, |
| 2805 | depth: number, |
| 2806 | check: UndeclaredKeyCheck |
| 2807 | ): boolean => { |
| 2808 | if (depth >= entry.path.length) return false |
| 2809 | if (node.is("alias")) { |
| 2810 | return isResolutionFinal() ? |
| 2811 | entryAtUndeclaredKey(node.resolution, entry, depth, check) |
| 2812 | : false |
| 2813 | } |
| 2814 | if (node.is("union")) |
| 2815 | return node.branches.some(b => entryAtUndeclaredKey(b, entry, depth, check)) |
| 2816 | if (!node.is("intersection") || !node.structure) return false |
| 2817 | const key = entry.path[depth] |
| 2818 | if (typeof key === "number") { |
| 2819 | const sequence = node.structure.sequence |
| 2820 | if (!sequence) return false |
| 2821 | if (!sequence.postfix) { |
| 2822 | const element = |
| 2823 | key < sequence.leading.length ? |
| 2824 | sequence.tuple[key].node |
| 2825 | : sequence.variadic |
| 2826 | return element ? |
| 2827 | entryAtUndeclaredKey(element, entry, depth + 1, check) |
| 2828 | : false |
| 2829 | } |
| 2830 | return sequence.tuple.some(el => |
| 2831 | entryAtUndeclaredKey(el.node, entry, depth + 1, check) |
| 2832 | ) |
| 2833 | } |
| 2834 | const prop = node.structure.byKey[key] |
| 2835 | return prop ? |
| 2836 | entryAtUndeclaredKey(prop.value, entry, depth + 1, check) |
| 2837 | : check(node.structure, entry, depth, key) |
| 2838 | } |
| 2839 | |
| 2840 | export const writeIndiscriminableMorphMessage = ( |
| 2841 | lDescription: string, |
no test coverage detected