Dev.to
7/23/2026

Strict Null Checks in TypeScript: What the Compiler Won't Tell You and Where It Actually Hurts in Production
Short summary
Strict null checks in TypeScript are necessary but not sufficient for null safety. The compiler validates static types but cannot verify runtime data shapes from APIs, databases, or external libraries. Four concrete patterns cause silent failures: broken assertion functions, inaccurate @types declarations, implicit any from libraries, and unvalidated external data. The fix is runtime validation at system edges using tools like Zod.
- •Strict null checks don't validate runtime data shapes from external sources
- •Assertion functions that don't throw create silent type lies the compiler accepts
- •Runtime validation at system boundaries (e.g., Zod) is essential for real null safety
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



