Repository navigation
Make catch clause variables optional #17467
Copy link
Copy link
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Activity
- addedES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScript
on Jul 27, 2017 - addedCommittedThe team has roadmapped this issueThe team has roadmapped this issue
on Jul 27, 2017 RyanCavanaugh commented
on Jul 27, 2017 MemberMore actions🚲 🏠 what should we name the variable when downleveling?
DanielRosenwasser commented
on Jul 27, 2017 MemberAuthorMore actionsI was thinking
unexpectedTokenInJsonAtPositionError.Reacted by Aluan HaddadI'd vote 🤷♀️, with further downleveling as appropriate.
Reacted by Jessica Franco, Ryan Cavanaugh, Aluan Haddad, Ali Taheri Moghaddar, Nicholas Steicke, Marco Buono and Michał Lytek- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on Aug 11, 2017 saschanaz commented
on Aug 14, 2017 ContributorMore actionsThe page is moved to https://tc39.github.io/proposal-optional-catch-binding/, for someone who wants to track the change of TS 2.5.
Just a thought but how about having the catch block itself as optional?
For example we have the 'traditional' try catch:
try { // Something risky } catch (e) { // Handle the specifics of e } // Continue
The 'I don't care what went wrong' try catch:
try { // Something risky } catch { // ¯\_(ツ)_/¯, Something happen lets do this instead } // Continue
So how about a 'I don't care' try (catch):
try { // Something risky } // Continue
That would be a good suggestion for ESDiscuss and I am sure that TypeScript would follow suit if the proposal made it. Diverging outside of that just in TypeScript wouldn't likely make sense.
Reacted by Zander, Michał Lytek and Alex- locked and limited conversation to collaborators
on Jun 14, 2018
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
The proposal by Michael Ficarra (@michaelficarra) makes the binding identifier in catch clauses optional.
For example:
This proposal reached stage 3 immediately upon presentation.