-
Notifications
You must be signed in to change notification settings - Fork 397
chore(repo): Typedoc: Handle <code> injection in function signatures #7010
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughIntroduces an internal flag to track rendering context within function signatures, conditionally suppressing code-block wrapping for types in those contexts. Adds a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes The TypeDoc theme changes introduce a new context-tracking mechanism with modifications across multiple partials, requiring careful review of the conditional logic and its interactions. The documentation removal is trivial but involves two distinct files with different purposes. Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.typedoc/custom-theme.mjs
(5 hunks)packages/backend/src/tokens/verify.ts
(0 hunks)
💤 Files with no reviewable changes (1)
- packages/backend/src/tokens/verify.ts
this._insideFunctionSignature = true; | ||
md.push(this.partials.signatureParameters(model.parameters || [])); | ||
this._insideFunctionSignature = false; | ||
|
||
if (model.type) { | ||
md.push(`: ${this.partials.someType(model.type)}`); | ||
this._insideFunctionSignature = true; | ||
const typeOutput = this.partials.someType(model.type); | ||
this._insideFunctionSignature = false; | ||
md.push(`: ${typeOutput}`); | ||
} |
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.
Restore _insideFunctionSignature
after nested calls
When superPartials.signatureParameters
/someType
recurse into other signature renderers (e.g., function types inside parameter or return types), our overridden signatureTitle
runs again and unconditionally clears _insideFunctionSignature
. Without restoring the previous state, the outer signature loses the guard and nested fragments fall back to <code>
-wrapping—the bug we’re trying to prevent resurfaces for composed signatures (think callbacks or higher-order function returns). Capture the prior value and restore it after the call.
- this._insideFunctionSignature = true;
- md.push(this.partials.signatureParameters(model.parameters || []));
- this._insideFunctionSignature = false;
+ const prevInsideParams = this._insideFunctionSignature;
+ this._insideFunctionSignature = true;
+ md.push(this.partials.signatureParameters(model.parameters || []));
+ this._insideFunctionSignature = prevInsideParams;
if (model.type) {
- this._insideFunctionSignature = true;
- const typeOutput = this.partials.someType(model.type);
- this._insideFunctionSignature = false;
+ const prevInsideType = this._insideFunctionSignature;
+ this._insideFunctionSignature = true;
+ const typeOutput = this.partials.someType(model.type);
+ this._insideFunctionSignature = prevInsideType;
md.push(`: ${typeOutput}`);
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
this._insideFunctionSignature = true; | |
md.push(this.partials.signatureParameters(model.parameters || [])); | |
this._insideFunctionSignature = false; | |
if (model.type) { | |
md.push(`: ${this.partials.someType(model.type)}`); | |
this._insideFunctionSignature = true; | |
const typeOutput = this.partials.someType(model.type); | |
this._insideFunctionSignature = false; | |
md.push(`: ${typeOutput}`); | |
} | |
const prevInsideParams = this._insideFunctionSignature; | |
this._insideFunctionSignature = true; | |
md.push(this.partials.signatureParameters(model.parameters || [])); | |
this._insideFunctionSignature = prevInsideParams; | |
if (model.type) { | |
const prevInsideType = this._insideFunctionSignature; | |
this._insideFunctionSignature = true; | |
const typeOutput = this.partials.someType(model.type); | |
this._insideFunctionSignature = prevInsideType; | |
md.push(`: ${typeOutput}`); | |
} |
🤖 Prompt for AI Agents
In .typedoc/custom-theme.mjs around lines 146 to 155, the code unconditionally
sets this._insideFunctionSignature = true before calling signatureParameters and
someType but does not restore the previous value, which breaks nesting when
those calls re-enter signature rendering; save the current value (e.g., const
prev = this._insideFunctionSignature), set it to true for the nested call, then
after the call restore this._insideFunctionSignature = prev — apply this pattern
to both the signatureParameters and someType calls so the original flag is
always restored even when nested renders occur.
Description
In this PR, the
Simplify
type was introduced to wrap the type forVerifyTokenOptions
, causing the docs for theverifyToken()
to changeBefore that PR:
Screen.Recording.2025-10-16.at.14.52.55.mov
After that PR:
Screen.Recording.2025-10-16.at.14.59.10.mov
The function signature incorrectly had
<code>
in the codeblock.This PR updates our typedoc theme to disallow the injection of a
<code>
in function signatures, as function signatures are already output into codeblocks.Changes regarding this PR:
Screen.Recording.2025-10-16.at.14.51.33.mov
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit