TypeScript TS18046: catch clause variable is of type unknown

Under useUnknownInCatchVariables, caught errors must be narrowed before reading `.message`.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.0.0
Identifier: TypeScript TS18046: catch clause variable is of type unknown Platform: TypeScript

Interactive Diagnostic Checklist

Safe Diagnostic Command:
npx tsc --noEmit

Technical Explanation

Under useUnknownInCatchVariables, caught errors must be narrowed before reading `.message`. Verified technical resolution: Narrow via `err instanceof Error ? err.message : String(err)`.

Worked Examples

  • Diagnostic check: npx tsc --noEmit

Limitations & Assumptions

  • Confirm exact software version and execution layer before applying configuration changes in production.

Source References & Verification

Resource ID: err-ts-18046-unknown-catch · Independently verified: 2026-11-25

Related Resources