-
-
Notifications
You must be signed in to change notification settings - Fork 247
Object schema breaking nested pipe output type #1095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for reaching out! This is not a bug. We expanded the validation capabilities of const Schema = v.optional(v.string(), 'default'); Feel free to reach out with any question you have. I am happy to explain what's happening under the hood. |
May I ask you to elaborate? |
Yes, I can explain it. |
I don't know if my problem is the same but I try to migrate to 1.0.0 and I have a problem with Before 1.0.0 if I made this : const schema = object({
a: nullish(string(), 'default'),
});
const result = parse(schema, {}}, {
abortEarly: true,
abortPipeEarly: true,
});
// { a: 'default'} After 1.0.0 I have an error : const schema = object({
a: nullish(string(), 'default'),
});
const result = parse(schema, {}}, {
abortEarly: true,
abortPipeEarly: true,
});
// Invalid key: Expected \\"a\\" but received undefined |
Hey again, I've noticed a weird behavior with the latest update.
Here is an example snippet of transform
pipe
nested inside anobject
schema.As you can see, the output type of that pipe is clearly
string
, but when it is nested inside anobject
schema it is still for some reason inferred as optional, while the type of a field that is directly assignedstring()
schema is inferred correctly.This is most likely a bug, could you please look into it?
Thanks!
The text was updated successfully, but these errors were encountered: