Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.language

Reassignment of catch binding

The catch clause parameter is assigned or updated after it is bound.

#Metadata

Rule ID
ts.correctness.reassign-catch-binding
Severity
medium
Confidence
0.9
Languages
javascript, typescript
Presets
recommended, strict
Stability
stable
Applies to
file
Tags
correctness, crq-cor-026, language, rules-catalog

#Why it matters

Catch bindings are immutable in strict mode and confusing in sloppy mode; reassignment usually indicates a mistaken mutation of the caught error.

#Remediation

Introduce a separate variable for any transformed error value and leave the catch parameter read-only.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.correctness.reassign-catch-binding.rule.yaml.