
Programming
Why doesn't `filter(Boolean)` narrow nullable arrays in TypeScript?
`filter(Boolean)` removes falsy values at runtime, but TypeScript still needs a callback shape it can treat as a narrowing predicate. This article shows the difference, proves it with a small compiler fixture, and explains when a truthiness filter is the wrong tool because `0` or `""` would disappear too.
About 6 min read










