You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eslint-factory: no-unsafe-catch-error-property — bare typeof err === 'object' guard is unsound for null #42435
typeof null === 'object'. So when the thrown value is null (or any non-Error object lacking the property), the guard passes and err.status is accessed anyway — null.status throws a TypeError, which is exactly the non-Error-throw failure mode this rule is meant to catch. The guard narrows nothing useful on its own; it gives a false sense of safety and silences the warning on genuinely unsafe code.
Note the very next valid fixture (line 349) does it correctly: typeof err === 'object' && err !== null. The rule should require that companion null check.
Acceptance criteria
A bare typeof err === 'object' (with no err !== null / err != null / truthiness companion in the same guard condition) no longer marks the frame as guarded.
typeof err === 'object' && err !== null (and equivalents: err != null, a preceding if (!err) return;, err && typeof err === 'object') continue to be accepted.
err instanceof Error and getErrorMessage(err) guards are unchanged.
Update no-unsafe-catch-error-property.test.ts: move the bare-typeof case (line 348) from valid to invalid, keep the null-checked cases (lines 349, 430) valid.
Apply the same tightening to no-unsafe-promise-catch-error-property, which shares the identical typeof === 'object' guard logic, for parity.
Relationship to existing issues
Distinct from #42189 (whole-frame vs. flow-sensitive guard placement). This is about the semantic strength of one specific guard form, not where it appears.
Activity
github-actions commentedon Jun 30, 2026
🍪 Issue Monster selected this for Copilot
I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.
If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪