How to retreive Error metadata
Hi!
I'm creating an error using Arktype and I want to attach metadata so I can format the message later in my UI (React + react-hook-form):
My problem is that i have to add "as any" to metadata. I found this for type metadata
https://arktype.io/docs/configuration#metadata
but couln't quite identify which interface i need to override in my case.
Did anyone encounter this issue before?
Thank you!
1 Reply
Hey! If react-hook-form provides a metadata type that represents what they're interested in (or if you define one yourself), you should be able to extend ArkEnv's metadata to include it like this:
However, in testing this I notice a bug where custom user metadata is not available in the
ctx.reject API. This will be fixed in the next release so you can stop casting! Feel free to open a github issue if you'd like it tracked