-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
issue: watch() does not return the same type passed to useForm #11480
Comments
Related #11359 |
+1 - also seeing this issue. Reverting back to 7.49.3 fixes it. |
is this a regression? |
This caused errors in about 10 files in our project. Most of these were caused by us calling watch without arguments and then destructuring the returned object. Like:
And these errors are easily fixed by specifying the prop: Which I assume is better anyway so I didn't mind fixing those. We did however have a couple of places where we want to watch the entire form and then I had to cast the return value of watch:
This seems unnecessary. |
looks like a regression. I Will revert that commit. Thanks for the update. |
reverted and publishing now. |
Version Number
7.50.0
Codesandbox/Expo snack
https://codesandbox.io/p/devbox/frosty-monad-gk8xw3?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cls8rzys400062v6kw1bmtxh5%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cls8rzys400022v6koztwxu09%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cls8rzys400032v6kwgz856tn%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cls8rzys400052v6k8al13bw8%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cls8rzys400022v6koztwxu09%2522%253A%257B%2522id%2522%253A%2522cls8rzys400022v6koztwxu09%2522%252C%2522activeTabId%2522%253A%2522cls8v4z6v00cs2v6k8jfje1jh%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cls8rzys400012v6k1xke0lmj%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fpublic%252Findex.html%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252F.codesandbox%252Ftasks.json%2522%252C%2522id%2522%253A%2522cls8v4z6v00cs2v6k8jfje1jh%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%252C%2522cls8rzys400052v6k8al13bw8%2522%253A%257B%2522id%2522%253A%2522cls8rzys400052v6k8al13bw8%2522%252C%2522activeTabId%2522%253A%2522cls8usqmt001a2v6kqff13d4r%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A5173%252C%2522id%2522%253A%2522cls8usqmt001a2v6kqff13d4r%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%257D%252C%2522cls8rzys400032v6kwgz856tn%2522%253A%257B%2522id%2522%253A%2522cls8rzys400032v6kwgz856tn%2522%252C%2522activeTabId%2522%253A%2522cls8v1w8j005h2v6k65lk1c13%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cls8v1w8j005h2v6k65lk1c13%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cls8v1wal000odigm0ons3moc%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
Steps to reproduce
The isssue is present on v7.50.0 and on v7.49.3
Expected behaviour
When calling watch() with out any parameters the type of all fields get set to "optional".
If you pass a parameter to watch() then the correct type gets returned.
Expect the typing og watch() without any paramater to return the same type as the generic passed to useForm()
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: