`.strict()` and `.and()` combined is not working
See original GitHub issueBug description
The method .strict()
and .and()
combined results in an unexpected parsing error.
Zod version
3.0.0-alpha.33
Playground
const a = z.object({ a: z.string() }).strict();
const b = z.object({ b: z.string() }).strict();
const c = a.and(b);
c.parse({ a: "a", b: "b" });
Output
error: ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"b"
],
"path": [],
"message": "Unrecognized key(s) in object: 'b'"
},
{
"code": "unrecognized_keys",
"keys": [
"a"
],
"path": [],
"message": "Unrecognized key(s) in object: 'a'"
}
]
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
What happens when you combine "use strict"; inside functions ...
It seems that when "use strict"; is both in the global context and in a function, they cancel out, since when I remove...
Read more >Strict equality (===) - JavaScript - MDN Web Docs
The strict equality (===) operator checks whether its two operands are equal, returning a Boolean result. Unlike the equality operator, the strict equality ......
Read more >JavaScript "use strict" - W3Schools
In strict mode, any assignment to a non-writable property, a getter-only property, a non-existing property, a non-existing variable, or a non-existing object, ...
Read more >If the code stops working when 'use strict' is added to it ... - Quora
Strict mode makes several changes to normal JavaScript semantics. First, strict mode eliminates some JavaScript silent errors by changing them to throw errors....
Read more >strict-dynamic in CSP - Content Security Policy
Support for nonce would still work in CSP Level 2 browsers, but not in CSP Level 1. Thankfully the authors of CSP Level...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
By the way, I just added an Ecosystem section to the README to boost projects like yours: https://github.com/colinhacks/zod/tree/v3#ecosystem
Don’t worry, I also have a lot of work and I totally understand than side-projects are not always a priority (and can be sometime hard to manage on top of all other stuff going on 😅 )