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
While working on a form with a custom validation function, I encountered behaviour inconsistent with the type declaration file:
The validate function is typed as taking the entire form props as an argument, when in reality it only receives the latest updated value. See below:
A quick fix would be to set the type of the argument to validate to be Partial<Inf>.
Longer term, it would probably be preferable to return the full type (all the values in the form) to the custom validate function, as this would allow behaviour such as ensuring validity of a form where two of the fields are linked, which currently is not possible.
The text was updated successfully, but these errors were encountered:
While working on a form with a custom validation function, I encountered behaviour inconsistent with the type declaration file:
The validate function is typed as taking the entire form props as an argument, when in reality it only receives the latest updated value. See below:
svelte-forms-lib/lib/index.d.ts
Lines 6 to 12 in 7df1b1d
svelte-forms-lib/lib/create-form.js
Lines 90 to 100 in 7df1b1d
A quick fix would be to set the type of the argument to
validate
to bePartial<Inf>
.Longer term, it would probably be preferable to return the full type (all the values in the form) to the custom validate function, as this would allow behaviour such as ensuring validity of a form where two of the fields are linked, which currently is not possible.
The text was updated successfully, but these errors were encountered: