fix(record-form): type useRecordForm bind's model as the record (PUI-124) #136
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/PUI-124-userecordform-bind-fails-the-playground-type-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes the playground type-check pass again: a page that spreads
useRecordForm'sbindon RecordForm without passinginitialno longer fails vue-tsc.On main,
cd examples/vue && bun run type-checkfails atSettingsForm.vue:201(TS2345).bind.modelValuewas typed record-or-undefined, but RecordForm requires a record. SettingsForm is the only form withoutinitial, and like every page it renders the form only oncemodelis set.Review guide
packages/ui/composables/useRecordForm.ts:RecordFormBinding<T>typesmodelValueandbaselineasT, and its JSDoc says to spreadbindonly wheremodelis set.modelandbaselinethemselves stayT | undefinedwithoutinitial.docs/cms/forms-and-validation.md(the example now guards onmodel), README, and the existing UnreleaseduseRecordFormentry in the CHANGELOG.Proof
useRecordForm.ts, the playground type-check fails with exactly that error; with this change it passes.bun run typecheck, lint and format pass;record-form-composable.test.ts: 19 pass.Choices made: dropped
RecordFormBinding's second type parameter (unreleased, no other users); no type-level test in packages/ui (the playground check is the guard, and PUI-121 adds it to CI).Closes PUI-124
Ready to merge. CI green (format, lint, typecheck, rust). Base: behind main by #135 (
61569a8), merges without conflicts. Proof: the playground type-check fails with the olduseRecordForm.tsand passes with this change. Review panel (one combined seat, small diff): nothing material. One nit not acted on: there's no type-level test in packages/ui; the playground check is the guard, and PUI-121 adds it to CI.Ready to merge. Update: main's 0.44.0 release stamped the useRecordForm entry this PR had amended, so main is merged in (
f580076) and the note now has its own## Unreleased→### Fixedentry (81af783), leaving 0.44.0 as released. Without that, the release job would have found Unreleased empty after the merge. CI green; base current with main (6802ee5). Merge this before #137 and #138: they touch the same lines in useRecordForm.ts and the docs, and I'll update them if they conflict.