Skip to content

Commit

Permalink
refine type checking
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Jacobs <570070+quantizor@users.noreply.github.com>
  • Loading branch information
devcrazygit and quantizor committed Apr 22, 2024
1 parent 4d610a6 commit 733240f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/formik/src/Formik.tsx
Expand Up @@ -608,7 +608,7 @@ export function useFormik<Values extends FormikValues = FormikValues>({
let parsed;
// If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),
// so we handle like we would a normal HTML change event.
if (!isString(eventOrTextValue) && typeof eventOrTextValue !== 'number' && typeof eventOrTextValue !== 'boolean') {
if (typeof eventOrTextValue === 'object' && 'nativeEvent' in eventOrTextValue && eventOrTextValue.nativeEvent instanceof Event) {
// If we can, persist the event
// @see https://reactjs.org/docs/events.html#event-pooling
if ((eventOrTextValue as any).persist) {
Expand Down

0 comments on commit 733240f

Please sign in to comment.