You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pretty basic stuff. The idea is to use it like so:
constsomeSchema=z.object({updated_at: dateString({invalid_type_error: "Field `updated_at` had wrong type"})})
Problem is whenever I do this, the custom error message doesn't seem to survive. I've tried all the fields under RawCreateParams, but still just get the default error object when parsing fails.
By contrast, doing this with a built-in schema works just fine:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hey there 馃憢馃徎 I'm coming in from
io-ts
and very happy to have found this project.TL;DR: assuming I've set up some of my own-built schemas correctly, I can't seem to get custom errors out of a
preprocess
-based schema.What I have is an own-rolled schema like the following, based on the
Dates
example from your docs:Pretty basic stuff. The idea is to use it like so:
Problem is whenever I do this, the custom error message doesn't seem to survive. I've tried all the fields under
RawCreateParams
, but still just get the default error object when parsing fails.By contrast, doing this with a built-in schema works just fine:
So, what am I doing wrong? Or is this a bug with
preprocess
?The text was updated successfully, but these errors were encountered: