Skip to content

catch clause annotations #47

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

Open
samwgoldman opened this issue Mar 9, 2022 · 3 comments
Open

catch clause annotations #47

samwgoldman opened this issue Mar 9, 2022 · 3 comments

Comments

@samwgoldman
Copy link
Collaborator

TypeScript supports annotations for try/catch, which is not listed in the proposal. Should this be added as well?

microsoft/TypeScript#41013

@VitorLuizC
Copy link

Maybe something like @throws to describe function/method's possible thrown errors.

https://jsdoc.app/tags-throws.html

@ljharb
Copy link
Member

ljharb commented Mar 9, 2022

imo this proposal should definitely include the ability to annotate the type of every single binding that is brought into scope, including catch bindings (see #37).

Catch bindings are structurally identical to function signatures, so I'm not sure why they'd need a different mechanism to annotate them.

@giltayar
Copy link
Collaborator

giltayar commented Mar 9, 2022

@samwgoldman I believe type annotations in the catch clause was added after I wrote the first draft of this proposal, so we missed it.

But this proposal isn't really trying to be exhaustive. I guess that's going to happen in stage 2. 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants