> Optional chaining or null checks should not be used "defensively"
Agreed. I often find the `Uncaught TypeError: Cannot read properties of null` error annoying. But I would rather see the error than let unknown nulls sneak through my codebase.
Agreed. I often find the `Uncaught TypeError: Cannot read properties of null` error annoying. But I would rather see the error than let unknown nulls sneak through my codebase.
1. Wait until TS complains about a possible null
2. If you have a good default value, use that instead
3. If not, throw a meaningful error
Either way, don't propagate the nulls further than they need to go.