docs(lib): add @throws JSDoc for JSON methods#61596
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 |
sandersn
left a comment
There was a problem hiding this comment.
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 <293473+sandersn@users.noreply.github.com>
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 |
|
TS5 parses |
Adds
@throwsJSDoc documentation toJSON.parseandJSON.stringifyto 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.tsfiles.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.