-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2] handleChange should accept any value #2084
Comments
What's the update on this bug? |
Shouldn't this be fixed? I still use patch-package to handle this tiny bug. |
I explain the resolution for this in depth here: #3013 (comment) Unfortunately, we need to upgrade TS to TS4 to actually solve this problem, so this will probably be a major version update. Edit: I do think we can accept |
The problem is not only types and typescript, but also functionally it only accepts strings or events. The types are actually correct, in that if you pass anything else, you run into this error: #1667 (dupes: #2942, #1973). Here are some closed PR's that try to address the above issue: Based on @johnrom 's comment here, it seems that |
🐛 Bug report
Current Behavior
I'm using Formik on React-native and Typescript.
For example, I have only one field of type number:
On input handleChange
formikProps.handleChange('val')(newVal as number);
Got this: Error:(100, 46) TS2345: Argument of type 'number' is not assignable to parameter of type 'string | ChangeEvent'.
Expected behavior
handleChange
should accept any value type likesetFieldValue
does.Your environment
The text was updated successfully, but these errors were encountered: