-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make catch clause variables optional #17467
Comments
🚲 🏠 what should we name the variable when downleveling? |
I was thinking |
I'd vote 🤷♀️, with further downleveling as appropriate. |
The 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. |
@ZanderBrown |
The proposal by @michaelficarra makes the binding identifier in catch clauses optional.
For example:
This proposal reached stage 3 immediately upon presentation.
The text was updated successfully, but these errors were encountered: