v0.1.2
Patch Changes
- Updated dependencies [a7bf591]
- @behivetech/forms.form-field@0.3.0
- @behivetech/forms.form-provider@0.1.2
`FormField` with its react-hook-form wiring already done — the control's value/onChange/onBlur/ref, the label association, and the error message.
Set GITHUB_PACKAGES_TOKEN to list published versions. The repo is at v0.1.2.
f8c57db: Generate TypeScript declarations once per build instead of once per format.
dist/index.d.cts is no longer emitted. Nothing referenced it: each package's exports["."].types points at dist/index.d.ts, which is unchanged and still covers both the import and require conditions. There are no API, type, or runtime changes.
Updated dependencies [f8c57db]
b98ff2a: narrow the render prop's value to the named field
ManagedField and FormFieldManagedProps now take TName as a second type
parameter and thread it into ControllerRenderProps. Previously TName sat at
its default, so field.value widened to a union of every field type in the
form and each call site needed value={field.value as string} — an assertion
that keeps compiling if the field later changes type, which is the mistake the
generic exists to prevent. rules.validate had the same problem.
The parameter defaults to the old behaviour, so existing callers, casts and all, keep compiling.
Getting the narrowing depends on how the generics are supplied. Passing
control infers both parameters and needs no annotation. Reading control from
context means naming both — <FormFieldManaged<Values, "email">. Supplying only
the first, <FormFieldManaged<Values>, does not narrow: TypeScript stops
inferring the remaining parameters once any is given explicitly. The README and
the component docstring cover both working forms, and a type test now enforces
the narrowing under check-types, which spec files are excluded from.