-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
.pick()
mask allowing non-present props when present props are defined
#895
Comments
Ideally typescript should cause an error. const fish = z.object({
name: z.string(),
age: z.number(),
nested: z.object({}),
}); And then: fish.pick({ name: true, color: true }) Doing this should show |
Ahh, nice find @prescience-data . This is due to how Line 1651 in d2ac69c
That means as long as it extends the shape it passes the type checker. I think there is a way to update this to require that all of the keys are valid keys from |
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. |
Example
This became an issue today where after passing through a bundler (esbuild), a non-descriptive error started throwing on
e.t._parse
:The issue occurred because I had removed a property
"title"
from the original schema, but not from thepick()
mask, sotitle._parse()
was throwing astitle
was now undefined.The text was updated successfully, but these errors were encountered: