question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

issue: ArrayPath is never when passing string[]

See original GitHub issue

Version Number

7.33.1

Codesandbox/Expo snack

https://codesandbox.io/s/hungry-keldysh-bshnz7

Steps to reproduce

  1. create a type containing string[].
  2. 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:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
bluebill1049commented, Jul 26, 2022

@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).

1reaction
Moshyfawncommented, Jul 26, 2022

@bluebill1049 any plans to add this in the future? Ran into the same issue as @tanmen, it would be useful. Thanks for the awesome library!

I don’t think so. We need the object shape to store the array field id to refer to

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found