T
TanStack7mo ago
exotic-emerald

Cant getFieldValue(array[idx]) ?

https://stackblitz.com/edit/vitejs-vite-25mr55we?file=src%2Fcomponents%2FForm.tsx See the type error on row 46, ? Why can't do I get a type error when trying to grab an object out of an array like this? Accessing specific rows in tables is VERY common when I've used RHF at my jobs. Example, lets say I want to set a row level error, now I'd be forced to target a specific field in the row :/ Is this perhaps a bug? At runtime you can see we are properly grabbing the item. Edit: Noticed this is NOT an issue if we user narrower types (such as using as const for default values... You can also see how I test that on rows 65 - 74 Opened issue: https://github.com/TanStack/form/issues/1227
juanvilladev
StackBlitz
Vitejs - Vite (forked) - StackBlitz
Next generation frontend tooling. It's fast!
GitHub
DeepKeys not handling regular array indexing · Issue #1227 · TanSta...
Describe the bug Anywhere that we accept DeepKeys we should allow accepting values for regular array indexing such as array[idx] this should result in getting the whole element in that position. Yo...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?