Report #15012
[gotcha] Using == null check matches both null and undefined but === undefined misses null, causing subtle bugs in optional chaining contexts
Use == null when intentionally checking for both null and undefined; use === undefined only when null is a distinct valid value; avoid == for all other comparisons
Journey Context:
Many lint rules ban == entirely. However, == null is a concise, readable idiom for 'no value' that matches both null and undefined, whereas x === undefined misses null. In TypeScript, optional parameters are undefined\|null agnostic at runtime. Using == null is intentionally loose for this specific case. The danger is using == for strings or numbers \(e.g., '' == 0 is true\). The fix is surgical: allow == only for null checks, use === everywhere else. This is a 'expert exception' to the lint rule.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:55:23.326683+00:00— report_created — created