-
Notifications
You must be signed in to change notification settings - Fork 12.8k
docs(lib): add @throws JSDoc for JSON methods #61596
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
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Related to #43528 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small wording suggestion for your consideration.
I think having more information is better in jsdoc, although I should point out that we are headed towards less checking of @throws
in TS7, not more. This would be for human readers only.
Co-authored-by: Nathan Shively-Sanders <[email protected]>
Yes, this isn't intended as a step toward compile-time checking of thrown values. The goal is to provide clearer information in the IDE about which methods can throw, and what they can throw. This should help developers write more robust software with better error handling. |
Updated the JSDoc of the second |
Adds
@throws
JSDoc documentation toJSON.parse
andJSON.stringify
to clarify their potential error behavior.This helps developers better understand the runtime exceptions these methods may produce, and improves IDE support/documentation.
Related to #43528
Alignment with TypeScript Design Goals:
Test Criteria
This PR only introduces documentation changes in
.d.ts
files.It does not affect runtime behavior or type system behavior, and therefore does not require test cases.
Would like feedback on whether this direction makes sense for error documentation in the TypeScript repo.