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
type FormValues = {
parent?: {
child: string;
};
};
Use useController, and you will find the field.value has wrong type for the child field
const { field } = useController<FormValues, "parent.child">({
name: "parent.child",
});
// the type shows "string", but it actually is "string | undefined"
const childValue = field.value;
This discussion was converted from issue #12221 on August 31, 2024 03:28.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.53.0
Codesandbox/Expo snack
Sandbox Link
Steps to reproduce
useController
, and you will find thefield.value
has wrong type for the child fieldExpected behaviour
field.value
should be type ofstring | undefined
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions