Menu

50,000 strictNullChecks Errors Later: Why null Belongs Only at Our Boundaries
πŸ“°

50,000 strictNullChecks Errors Later: Why null Belongs Only at Our Boundaries

DEV Community: typescriptΒ·vladimir ivanovΒ·8 days ago
#Sbby3Tcd
#devtotypescript#devto#dev#null#undefined
Long article (2331 words) β€” no AI summary yet.
Reading 0:00
15s threshold

For years, I had a simple, unspoken rule in TypeScript: always use undefined , never null . It worked cleanly, my types stayed simple, and I never gave it a second thought.

Then I joined my current contract.

It's a large monorepo with 50+ fullstack developers, and when it comes to empty values, it is pure chaos. Without a shared convention, everyone just guesses. Some developers reset form fields to null , others use undefined , and some use empty strings. Because data flows back and forth to a backend running Apache Avro (which explicitly turns missing values into null over the wire), null slowly bled into every corner of our React components, utility functions, and state management.

To make matters worse, strictNullChecks had been disabled from day one, eight years ago. When we finally turned it back on, TypeScript surfaced over 50,000 errors.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.