You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(form-core): keep undefined out of the field error array type
`FieldLikeMetaDerived['errors']` unions `UnwrapOneLevelOfArray<...>` over all
nine validator slots. Every slot without a validator resolves to `undefined`,
and `UnwrapOneLevelOfArray<undefined>` is `undefined`, so each unused slot
leaked `undefined` into the element type.
With a single form-level Standard Schema — eight slots unused — the array
inferred as `(StandardSchemaV1Issue | undefined)[]`, which cannot be iterated
without a guard or a cast.
The value is already filtered at runtime, and the form-level `errors` types
already wrap their union in `NonNullable`. Wrap the field-level union to match.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Remove the spurious `undefined` from the element type of `field.state.meta.errors`. Each unused validator slot previously contributed `undefined` to the union, so a single form-level Standard Schema produced `(StandardSchemaV1Issue | undefined)[]` and the array could not be iterated without a guard or a cast. The array is already filtered at runtime, and the form-level `errors` type is already wrapped in `NonNullable`; this aligns the field-level type with both.
0 commit comments