Optional catch binding S4
- Stage: Stage 4
- Status: Finished
- ECMAScript edition: ES2019
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
This proposal addresses the common practice of using an unused catch binding (e.g., catch (unused)) in scenarios where errors are intentionally ignored, which can signal a programming error. It introduces a grammar change to ECMAScript allowing the omission of the catch binding and its parentheses, enabling syntax like catch { . }.
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
This proposal makes a grammatical change to ECMAScript, allowing the omission
of a catch binding in cases where the binding would not be used. This occurs
frequently with patterns such as
or
or
and it is a common opinion that variables which are declared or written to but never read signify a programming error.
The grammar change introduced by this proposal allows for the catch binding
and its surrounding parentheses to be omitted, as in
See the the full text of the proposal for more info.