-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Type inference incorrectly sets all fields as optional by default #43
Comments
You have to use Zod with strict mode. This wasn't clear from the README - my bad. Just add |
Also be sure to NOT set |
strict and strictNullChecks both true also all fields are optional moreover - any primitive type and array of promite types work fine but not object |
Make sure your IDE or editor setup is properly getting your |
strict and strictNullChecks both true Using VScode. I have restarted the IDE multiple times. All my object field types are still being inferred as optional. Edit: Seems to be VSCode problem... |
how did you fix this? edit: |
Zod version: 1.5.0
TS version: 3.8.3
The type inference does not seem to be working properly, making all values of objects to be optional by default.
Let me take this code derived from the readme:
The expected behavior would be a compilation error deriving from
name
andneutered
to be required.The text was updated successfully, but these errors were encountered: