zod
zod copied to clipboard
Update documentation to include `strictNullChecks` as required
This PR is intended to help other engineers avoid the same mistake I made by having strict
set to true but not strictNullChecks
which led to very frustrating / confusing functionality when dealing with static typechecking
Deploy Preview for guileless-rolypoly-866f8a ready!
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | 129d7359fdd3ecb8a565a0a87e3a02878fa1847a |
Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/6335547c55c59500097074de |
Deploy Preview | https://deploy-preview-1438--guileless-rolypoly-866f8a.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
FWIW, strict
implies strictNullChecks
, so I think our stance is still "enable strict
" since we rely on the most strict behavior possible. The fact that you can opt out of certain parts of the strict-mode is understandable but unfortunate, and this is a speed bump that people run into, so I'm 👍 for this change for practicality,
For the sake of future-proofing Zod, I think we should assume that strict
mode is enabled, and none of its individual components have been disabled. I'm not sure if Zod compiles if only strictNullChecks
istrue
but none of the other strict mode checks. Strict mode also may encompass other flags later so it's easiest to have a blanket policy of "use strict mode".
@colinhacks
For the sake of future-proofing Zod, I think we should assume that strict mode is enabled, and none of its individual components have been disabled.
This is my strong feeling as well. It is a common pitfall (probably 40% of all questions and issues are exactly this issue) and sometimes people extend base configurations that do not make it obvious that there is something wrong. Maybe the better approach here is to add a troubleshooting or FAQ section to address "Why is my object schema partial?"