ParseError: undefined must be a PropertyKey or stringifyNonKey must be passed to options
Hello! When
key
isn't provided in the .map
function, the above error is thrown.
Not working code:
Working code (simply added key
to return object):
Is there a reason for this behavior? I would expect the key to already be present on the prop
11 Replies
It doesn't seem like you have the latest code since in the new version,
.map
expects an object as a return type
Oh nevermind
Oh wait
Yeah that doesn't look right
You're adding multiple props of the same key?
What was the error you got?
I'd expect them to intersect and if they're incompatible you'd get an error
There should really only ever be one mapped prop
per key
So what you'd want instead of:
is:
It's unfortunate that return doesn't just error because it shouldn't match the mapped type
It does seem like there's lots of type errors for me hahaIt was
ParseError: undefined must be a PropertyKey or stringifyNonKey must be passed to options
I see, thank you! I was just going off the example in https://discord.com/channels/957797212103016458/1114601623285678192/1285571762582458399
This mapping will make it really straightforward to automatically add the constraints to fields through Conform
POC for default values:
Yeah that looks a lot easier! It's even nicer if you're mapping a known set of keys because then you get strict inference for the defaults, but even if you are doing it generically and have to cast it still makes the runtime part of it a lot easier
Yessssss
And it works 🤩
Really, it's magical
Looks clean!
Now just to make the constraints + polish out the mapping of different form values, and Conform will be Conquer
Amazing! Then you'll publish it as an ecosystem library so that everyone can use it right? 🙏
That's the plan!!!
I'm excited making forms could really be this intuitive
Really excited to see that come to fruition!