-
-
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
handleChange type doesn't work #3013
Comments
You would have to pass If that callback is typed with a string, that would be an issue. It should be const [{ onChange }] = useField<number>("lengthMeterTo");
// this onChange expects a number.
<YourInput onChange={onChange} /> What you're requesting for handleChange is actually impossible to completely type. Even though you suggest "kind of" typing it, it doesn't type it based off of Values and name, so it is an incomplete type. We're trying to figure out how to give full typing to values and all related callbacks based on name, and have had some success with #1334 #2655 but nothing to merge just yet. Our successful tries require bleeding edge TypeScript, which we're not going to depend on just yet. Probably targeted for v3. |
Thanks for getting back to me, that solution works for me! |
Duplicate of #2084 at al |
Bug report
Current Behavior
no type error with
Expected behavior
with this commented
we finally get type error
Reproducible example
Suggested solution(s)
https://github.com/formium/formik/blob/80f9a831797429ae3c4457a47b6d8391e9d8bd2c/packages/formik/src/types.tsx#L140-L145
modify preact-like typing
Additional context
Your environment
The text was updated successfully, but these errors were encountered: