Replies: 1 comment 6 replies
-
Did you ever find a solution to this? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all!
I'm having an issue when using the
FieldPathByValue
type along with thegetValues
function.How to reproduce:
Expected behaviour:
value
should be of typestring
setValue
should only allow a string value as its second argumentCurrent behaviour:
value
is of typePathValue<TFieldValues, FieldPathByValue<TFieldValues, string>>
which seems to be behaving likeany
.setValue
does not allow a string value to be passed as its second argument. It gives the following error:Note:
I can get around the
getValues
issue by using a type guard, but thesetValue
issue is a lot more problematic.Question:
Am I missing something here or
value
should indeed be of typestring
?In fact, more generally,
PathValue<TFieldValues, FieldPathByValue<TFieldValues, T>>
should resolve toT
and notany
.Is there any way to get the proper type out of
getValues
andsetValue
or is this just not currently supported in RHF?Beta Was this translation helpful? Give feedback.
All reactions