Commit ae64947
fix(spec): let defineSeed type a multi-value lookup as an array of keys
CI caught the other half of #3911: the RUNTIME resolved a natural-key array
fine, but `defineSeed`'s record typing still declared every lookup as
`string | null`, so authoring the array the loader now wants was a compile
error (`Type 'string[]' is not assignable to type 'string'`) — the showcase
seed added in the previous commit is exactly that case.
`SeedFieldValue` widens a `multiple: true` lookup to `string | string[] | null`.
A lone string stays legal there (the loader accepts it as one-element shorthand
for the array shape the field stores); `master_detail` is inherently single and
is not widened; an array on a single-value lookup and a wrapper object inside a
multi array both remain compile errors — the guard that comment promises is
intact, verified in both directions.
Reaching that required `Field.lookup` to stop widening its config: with
`config: FieldInput` the literal `multiple: true` collapses to `boolean` before
it ever reaches the seed type. It is now generic over a `const` type parameter,
with the return type intersected with `FieldInput` so the optional surface is
unchanged — narrowing to just the passed keys broke consumers that read
`.options` off a field union (app-todo). Type-level only; the returned object is
identical at runtime.
Repo-wide `pnpm -r typecheck` is clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gusro3gdGv4wgbBnaFy9ah1 parent 627b188 commit ae64947
3 files changed
Lines changed: 40 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
725 | 739 | | |
726 | 740 | | |
727 | 741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
101 | 111 | | |
102 | 112 | | |
103 | 113 | | |
| |||
0 commit comments