issue: ArrayPath is never when passing string[]
See original GitHub issueVersion Number
7.33.1
Codesandbox/Expo snack
https://codesandbox.io/s/hungry-keldysh-bshnz7
Steps to reproduce
- create a type containing string[].
- specify its property in useFieldArray
Expected behaviour
Not “never” and no error if specified.
What browsers are you seeing the problem on?
Firefox, Chrome, Safari, Edge
Relevant log output
(property) name: never
Type 'string' is not assignable to type 'never'.ts(2322)
fieldArray.d.ts(7, 5): The expected type comes from property 'name' which is declared here on type 'UseFieldArrayProps<FormValues, never, "id">'
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
reactjs | `allName.${number}.nestedArray`' in react hook form
Your nestedIndex prop for NestedFieldArray is declared as type string , yet it's getting passed a number in the <Fields> component. It should ......
Read more >useFieldArray TS error: "Type string is not assignable to never"
I get a "Type string is not assignable to never" Typescript error with the following application of useForm icw. useFieldArray :.
Read more >TypeScript: type-safe get and set functions - part 1
In these series of articles I'm going to show you how to write type-safe get and set functions.
Read more >Typescript and Array.reduce() - JavaScript - SitePoint Forums
At first I took it to mean that.reduce() passed arguments of different ... T extends string ? string[] : T extends number ?...
Read more >How to pass arrays - the Tcler's Wiki!
This is due to Tcl currently passing only 'string' type data as arguments, and arrays not having a simple string notation for their...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Moshyfawn is correct ❤️ @jones-sam this is currently its limitation as we will need a unique id for each row since each field array is not re-render the entire field’s arrays (fully controlled).
I don’t think so. We need the
object
shape to store the array fieldid
to refer to