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
According to the tsdoc included with validate Validate a value against a struct, returning an error if invalid, or the value (with potential coercion) if valid., the value should still be coerced by defaulted, just like create.
The text was updated successfully, but these errors were encountered:
Found out there is an optional parameter for coerce on validate. I will leave this open, since I think the doc comment on validate is misleading. It should be more clear that it only coerces if the coerce parameter is set to true.
Take the following code snippet:
The previous code will have this error message in the err object:
StructError: At path: def -- Expected a string, but received: undefined
.Now take this code snippet instead:
This code works perfectly.
According to the tsdoc included with validate
Validate a value against a struct, returning an error if invalid, or the value (with potential coercion) if valid.
, the value should still be coerced by defaulted, just likecreate
.The text was updated successfully, but these errors were encountered: