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): Prevent synchronous validators from returning Promises
Passing an asynchronous function to a synchronous validator (i.e.: `onBlur`, `onChange`,
`onDynamic`, `onSubmit`) is a bit of a foot-gun given that it does not produce any typescript
errors, but it also results in the form/field validation function running after the core
validation logic.
To prevent this, update the types for these validator functions on both `FormApi` and
`FieldApi` to prevent passing a function that returns a `Promise`.
* Optional function that validates the form data when a field loses focus, returns a `FormValidationError`
204
209
*/
205
-
onBlur?: TOnBlur
210
+
onBlur?: RejectPromiseValidator<TOnBlur>
206
211
/**
207
212
* Optional onBlur asynchronous validation method for when a field loses focus returns a ` FormValidationError` or a promise of `Promise<FormValidationError>`
* The default time in milliseconds that if set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds.
0 commit comments