Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 0f99492

Browse files
committed
test(types): teach the WiderThanDeclared operator to see an open-record mirror
`zod-mirror-parity.test.ts` decided the WIDER direction with one assignability test, and that test cannot separate `Record[string, V]` from `Partial[Record[UNION, V]]` in EITHER direction — the two are mutually assignable, because TypeScript grants an implicit index signature to mapped and anonymous object types. So a mirror spelled `z.record(z.string(), V)` read as clean against a declaration over a finite key union while genuinely accepting keys the declaration refuses, and both parity directions agreed it was clean (objectui#8517). The repair adds an OPEN-RECORD clause on the branch the assignability test already called clean, so it is additive by construction: a key reported before cannot stop being reported. It reports only the unambiguous case — the mirror has a union arm that is a string-index record with no literal members of its own (the `z.record(z.string(), V)` shape and nothing else), and the declaration has a finite-keyed arm and no open one. Two halves of the predicate were MEASURED rather than reasoned about, each after the pin written for it failed. A zod LOOSE object also answers `true` to `string extends keyof T`, so requiring no literal members is what keeps the whole passthrough population out; and `keyof number` resolves to that primitive's method names, so `FiniteKeyedArms` has to exclude non-objects or a permissive `number | object` declaration reads as narrow. Census delta, measured with the file's own ledger reconciliation: 2 pairs and 2 keys ENTER, none leave. `layout.zod.ts#GridSchema::columns` (objectui#8516's instance) and `reports.zod.ts#ReportComponentSchema::exportConfigs`, which was not known to exist. Both are demonstrated at runtime as accept-set gaps — `safeParse` green, `tsc` refusing the same document — so neither can be read as an artifact of the new clause. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
1 parent 3f775ee commit 0f99492

2 files changed

Lines changed: 404 additions & 6 deletions

File tree

‎.changeset/tame-buses-clean.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
Test-only change to `@object-ui/types`' zod-mirror parity ledger: the `WiderThanDeclared` operator can now tell a `z.record(z.string(), V)` mirror from a partial record over a finite key union (objectui#8517). No published type, mirror or runtime behaviour moves — the file is under `src/__tests__/`, which `packages/types/tsconfig.json` excludes from the emitting build.

0 commit comments

Comments
 (0)