I'm reviewing a codebase with over 750 uses of optional chaining


I'm reviewing a codebase with over 750 uses of optional chaining.

Example:
user?.email

I continue to believe adding this feature to JS was a mistake.

It encourages lazy, sloppy, brittle, ambiguous code.
Solution: Ban it.

Use ESLint to forbid usage, and suggest validating data via tools like Zod to narrow the type before usage instead.

Here's how:

View original on X