-
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
Support for the ECMAScript 'throw' operator #18798
Conversation
@rbuckton Can you include a link to the ECMAScript proposal in the OP, for posterity? |
@weswigham, I've updated the description. I was waiting on the transfer of the proposal repository to the tc39 organization. |
👍 |
I'm going to add an |
Based on today's discussion (#18895), we want to hold off on this untill it makes stage 3, then include it without a flag. |
Are there plans for a similar const _crypto = try { require('crypto') } catch { } |
@mihailik |
@plantain-00 not really, in fact it often goes in the opposite direction. |
@mihailik nope, that is exactly how it is supposed to be done -- via TC39. TypeScript is not adding any additional syntax that is not being tracked by TC39, besides the current syntax that is being grandfathered in (as, namespace, enum) and JSX. At any rate, I expect that, were you to propose it right now, it would get deferred in favor of |
Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it. |
This PR adds support for the stage-2 ECMAScript 'throw' operator: https://github.com/tc39/proposal-throw-expressions.
NOTE: This feature does not yet support reachability checks at the expression level (e.g. in
(throw x), y
,y
should be considered unreachable). I can investigate this either as part of this PR or (preferably) in a follow-up PR. Our current reachability algorithm does not work well with expressions and will require some further investigation to make it more robust.Fixes: #18535