fix(repo,shared): backfill inline-object JSDoc on Omit/Pick-resolved types#9052
Conversation
When TypeScript resolves a type through `Omit<…>` / `Pick<…>`, inline anonymous object literal property reflections get re-synthesized and TypeDoc only retains the leading property's JSDoc — the rest come through with `comment === undefined`. The same shape elsewhere in the project (e.g. on the un-resolved type) carries all comments correctly. Group `TypeLiteral` reflections by structural fingerprint (sorted `(name, type, optional)` tuples of property children) at `RendererEvent.BEGIN`; within each group, copy missing comments from the most-commented sibling onto the others. Surfaced concretely as the empty descriptions on `telemetry?.debug?` and `telemetry?.perEventSampling?` in `react/clerk-provider-props.mdx`, while the sibling at `shared/clerk-options.mdx` (rendered via the parallel union-arm path) had all three. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 8b9da58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds a Typedoc post-processing step that backfills missing inline object property comments during rendering, and updates JSDoc text and links in billing and organization domain type files. ChangesTypedoc inline object comment backfill
Billing and organization domain JSDoc updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
fa8faaa to
4a865b3
Compare
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.typedoc/custom-plugin.mjs:
- Around line 595-599: The backfill logic in custom-plugin.mjs is treating empty
comments as missing, so intentionally empty descriptions can be overwritten.
Update the ReflectionKind.Property loop to only copy from bestByName when
child.comment is truly absent, and avoid relying on comment.summary.length as
the missing check; keep any existing empty comment created earlier by
`@generateWithEmptyComment` intact.
- Around line 529-544: The fingerprint logic in `typeFingerprint` is too shallow
for `reference` and `reflection` types, causing collisions between distinct
generic instantiations and inline shapes. Update the `reference` case to
incorporate `t.typeArguments` into the fingerprint, and expand the `reflection`
case to include each child property’s nested type fingerprint in addition to its
name and optional flag. Keep the existing `union` and `intersection` sorting
behavior, and make sure the updated fingerprint remains deterministic for
`ReflectionKind.Property` children.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Repository UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b2e5a7f-3e13-48a8-8bec-ff7cb43e1584
📒 Files selected for processing (4)
.changeset/fix-typedoc-inline-object-comment-backfill.md.typedoc/custom-plugin.mjspackages/shared/src/types/billing.tspackages/shared/src/types/organizationDomain.ts
Tighten the backfill guard so `@generateWithEmptyComment` survivors keep their empty descriptions instead of being overwritten with sibling JSDoc. Treat any `.comment` object as user intent — only fill children with no comment at all, and only from sources whose summary is non-empty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… shapes
Reference fingerprints now include type arguments and reflection fingerprints
recurse into each property's type, so `Foo<string>` vs `Foo<number>` and
`{ x: string }` vs `{ x: number }` no longer collide. Threads a shared
`Set<number>` of visited reflection ids through the recursion to guard against
cycles.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Description
Restores JSDoc comments on inline anonymous object literal property reflections that TypeDoc loses when a type is resolved through
Omit<…>/Pick<…>. Concretely fixes the empty descriptions ontelemetry?.debug?andtelemetry?.perEventSampling?rows inreact/clerk-provider-props.mdx(and any sibling page that flattens the same inline shape).Root cause. When TypeScript walks
ClerkProviderProps = Omit<IsomorphicClerkOptions, …> & {…}, the inline{ debug?, disabled?, perEventSampling? }arm oftelemetrygets re-synthesized — and only the leading property's JSDoc survives. The same shape on the un-resolvedIsomorphicClerkOptions['telemetry']carries all three comments correctly. Confirmed with debug logging: the buggy reflection had children withcomment === undefinedondebugandperEventSampling; the clean reflection elsewhere in the project had all three.Fix.
.typedoc/custom-plugin.mjs: atRendererEvent.BEGIN(after cross-package merging), groupTypeLiteralreflections by structural fingerprint (sorted(name, type, optional)tuples of property children); within each group, copy missing comments from the most-commented sibling onto the others. Single-pass mutation on the project model so every render path sees correct data.Also ships a small JSDoc tidy on
BillingNamespace/OrganizationDomainResource(separate commit): add missing@returnsannotations and drop stale/nextjs/segments from doc links.Verification. Diffed pre-fix vs post-fix
.typedoc/docs— exactly one file changed (react/clerk-provider-props.mdx), two lines, just the previously-empty cells filled in. No collateral changes elsewhere..typedocvitest suite: 16/16 pass.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
@returnstext and updated reference links.