docs: Expand error and assertion guidance documentation - #28247
Joshua Smithrud (Josmithr) wants to merge 4 commits into
Conversation
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (144 lines, 3 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
🟡 Changes recommended
The debugAssert example does not type-check, and several documentation consistency issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Expands Fluid Framework guidance for errors, assertions, and TSDoc @throws usage.
Changes:
- Adds error and assertion usage guidance.
- Documents TSDoc
@throwsconventions. - Clarifies inline assertion documentation practices.
File summaries
| File | Summary |
|---|---|
docs/content/Guidelines/Documentation-Guidelines/Documenting-TypeScript/TSDoc-Guidelines.md |
Adds @throws guidance and examples. |
docs/content/Guidelines/Documentation-Guidelines/Documenting-TypeScript.md |
Clarifies assertion-related documentation. |
docs/content/Guidelines/Coding-Guidelines.md |
Expands error and assertion recommendations. |
Review details
Suppressed comments (3)
docs/content/Guidelines/Coding-Guidelines.md:729
- This example repeats the same inconsistency: the surrounding guidance requires linking supported error types, but the example uses plain-code
RangeError. Use a TSDoc link here as well so the coding-guideline example demonstrates the documented convention.
* @throws A `RangeError` if the index is not an integer or is outside the supported range.
docs/content/Guidelines/Coding-Guidelines.md:613
- This example does not type-check against
debugAssert's signature (predicate: () => true | { toString(): string }): the comparison produces a generalboolean, so the||expression isboolean | stringand may returnfalse, which is not assignable to the required predicate result. Use a conditional that returns the literaltrueon success, for examplecachedValues.size <= capacity ? true : "The cache must stay within capacity.".
debugAssert(() => cachedValues.size <= capacity || "The cache must stay within capacity.");
docs/content/Guidelines/Documentation-Guidelines/Documenting-TypeScript/TSDoc-Guidelines.md:250
- The new guidance says to use
{@link ...}for error types available at the API's support level, but this example formats the available built-inRangeErroras plain code. Please make the example follow the rule it introduces, for example by linkingRangeError.
* @throws A `RangeError` if index is not an integer or is outside the supported range.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
Follow-up to #28245