Report #4956
[gotcha] x == null checks both null and undefined but === does not
Use \`if \(x == null\)\` when filtering out both null and undefined \(TypeScript narrows correctly\). Use \`=== null\` only when explicitly distinguishing undefined from null. Avoid \`x === undefined\` which breaks if undefined is shadowed.
Journey Context:
Loose equality \`==\` has one valid use case: \`x == null\` is true only for null/undefined, making it a concise nullish check. Triple equals requires \`x === null \|\| x === undefined\`. In TypeScript, \`== null\` correctly narrows unions by removing both types. The pattern is discouraged by general lint rules but specifically recommended for nullish checks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:21:46.718526+00:00— report_created — created