-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Typed error handling #55639
Labels
Duplicate
An existing issue was already created
Comments
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
π Search Terms
"thows", "typed error handling", "strict error"
β Viability Checklist
β Suggestion
Would be great to have a way to define the type of error(s) a function or method can throw
π Motivating Example
Safer error handling and dev experience on exceptions
Type-safe error handling would improve the code experience, giving faster feedback on which kind of exception is possible or even with a
catch
error type inference.π» Use Cases
basic throw annotation:
I think ideally the
throw
could even be optional, as I believe the compile could infer thethrow
types in the function body.Feels like a hole in the possible very strict type check philosophy of TypeScript
We have to manually type check the exception or weak type it
The text was updated successfully, but these errors were encountered: