Skip to content

docs(repo): Add typedoc comments; generate typedoc output for /objects docs#8276

Draft
alexisintech wants to merge 83 commits into
mainfrom
aa/generate-object-docs
Draft

docs(repo): Add typedoc comments; generate typedoc output for /objects docs#8276
alexisintech wants to merge 83 commits into
mainfrom
aa/generate-object-docs

Conversation

@alexisintech
Copy link
Copy Markdown
Member

@alexisintech alexisintech commented Apr 9, 2026

⚠️ In conjunction with Generate object reference docs

Description

For the /objects in clerk-docs, we want to generate the reference information. In summary, this PR's main change is that:
When typedoc goes to generate files, it creates a folder for each defined object (which we define in reference-objects.mjs. E.g. clerk object gets .typedoc/docs/shared/clerk folder. This folder will have a <OBJECTNAME>-properties.mdx file and a <OBJECTNAME>-methods folder that includes each of the methods.

In a little more detail:

In reference-objects.mjs, we define these objects by defining the Typedoc output paths and by defining the primary interface/class on each reference object page in order to resolve TypeDoc reflections.

The extract-methods.mjs script will extract all of the methods from that object's primary interface/class and create a dedicated file for each one. I won't go into lengthy detail here, but the file is heavily commented through.

In custom-router.mjs

  • Adds logic to ensure that for the defined REFERENCE_OBJECT_PAGE_SYMBOLS, dedicated folders are created for each object. So clerk.mdx no longer gets added to .typedoc/docs/shared/, it gets added to its own folder: .typedoc/docs/shared/clerk/

In custom-plugin.mjs

  • Updates all regex so that links are never added to headings (# - #######)
  • Adds applyRelativeLinkReplacements() helper that the extract-methods.mjs script uses to incorporate the link replacements into the files it generates
  • Adds applyCatchAllMdReplacements() helper that the extract-methods.mjs script uses to incorporate the catch-all replacements into the files it generates
  • Adds stripReferenceObjectPropertiesSection() which removes the Properties section from a generated file and puts it into its own file. For example, if shared/clerk/clerk.mdx is generated, it pulls the Properties section from it and puts it into its own shared/clerk/clerk-properties.mdx file.

comment-utils.mjs is used as a helper to remove "TODO" and its following text from generated content.

standalone-page-tag.mjs adds support for a custom tag called @standalonePage that can be used in conjunction with the @inline tag to indicate to typedoc to still generate a dedicated page for that type, even though it is recognized as @inline. Using both of these tags means that the type will show up as inlined in a table, but will also still have a generated MDX file.

Notable additions:

  • Parameters that accept objects will include the object's properties in the table as children of that parameter.
    See the following examples (with before on left, after on right):
    Screenshot 2026-04-13 at 18 55 29
    Screenshot 2026-04-17 at 18 09 57
  • If a parameter links to a dedicated page, parameter children (a?.b, a?.c, a?.d) are not shown in the table.
    Screenshot 2026-04-17 at 18 11 16
  • If a method accepts only one parameter, the parameters section will be of that type. E.g. for joinWaitlist(), it accepts a params object of type JoinWaitlistParams. Instead of a "Parameters" section, it has a "JoinWaitlistParams" section:
    Screenshot 2026-04-13 at 18 59 45

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: 0cdd2a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@clerk/backend Patch
@clerk/clerk-js Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/nextjs Patch
@clerk/react Patch
@clerk/shared Patch
@clerk/ui Patch
@clerk/vue Patch
@clerk/astro Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/chrome-extension Patch
@clerk/expo-passkeys Patch
@clerk/localizations Patch
@clerk/msw Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 28, 2026 1:00am

Request Review

@alexisintech alexisintech changed the title Drop functions from property tables; add JSDoc comments docs(shared): Add/update typedoc comments; remove functions from generated property tables Apr 9, 2026
@alexisintech alexisintech changed the title docs(shared): Add/update typedoc comments; remove functions from generated property tables docs(shared): Add/update typedoc comments; remove functions from generated property tables for /objects Apr 10, 2026
@alexisintech alexisintech changed the title docs(shared): Add/update typedoc comments; remove functions from generated property tables for /objects docs(shared): Add typedoc comments; remove functions from generated property tables for /objects Apr 10, 2026
@SarahSoutoul
Copy link
Copy Markdown
Contributor

@alexisintech just pushed this Fix external link as the external link wasn't working.

@alexisintech
Copy link
Copy Markdown
Member Author

alexisintech commented May 15, 2026

make frontend api url open in new tab

sorry was still generating to test, and in between tasks, but thanks for catching! 🤦‍♀️

Copy link
Copy Markdown
Contributor

@manovotny manovotny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's some things that caught my eye.

Comment thread packages/shared/src/types/apiKeys.ts
Comment thread turbo.json Outdated
Comment thread .typedoc/reference-objects.mjs
Comment thread packages/shared/src/types/clerk.ts
Comment thread .typedoc/custom-theme.mjs
Comment thread .typedoc/comment-utils.mjs Outdated
Comment thread .typedoc/comment-utils.mjs Outdated
Comment thread .typedoc/extract-methods.mjs

/**
*
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there several empty comments like this one in the file?

In the following files too:

  • packages/shared/src/types/resource.ts
  • packages/shared/src/types/session.ts
  • packages/shared/src/types/signInFuture.ts
  • packages/shared/src/types/signUpFuture.ts
  • packages/shared/src/types/user.ts
  • packages/shared/src/types/waitlist.ts

(I probably missed a few other files)

Copy link
Copy Markdown
Member Author

@alexisintech alexisintech May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's to tell typedoc to generate them. typedoc requires jsdoc comments as a signal that something needs to get generated. these don't always require anything written - if it makes more sense to fill these with descriptions, we can (but will need to test that it doesn't break any output). should we fill these comments so that no one else is confused?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so unfortunately, filling those comments will affect the output files and add the descriptions to the top of the files, which is something we don't want because we use those property tables as they are

Screenshot 2026-05-22 at 17 47 18

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something slightly better is we can change it from

/**
 *
 */

to

/** */

I can do it once the other PR gets pulled in here so its not twice the work or causing any merge conflicts

Copy link
Copy Markdown
Contributor

@manovotny manovotny May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be better. I'd still like to see if we can remove them altogether or have a placeholder reason. But we can revisit both later.

Comment thread packages/shared/src/types/clerk.ts Outdated
@alexisintech
Copy link
Copy Markdown
Member Author

@alexisintech
Copy link
Copy Markdown
Member Author

unsafeMetadata section added successfully:

Screenshot 2026-05-27 at 15 04 12

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8276

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8276

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8276

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8276

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8276

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8276

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8276

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8276

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8276

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8276

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8276

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8276

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8276

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8276

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8276

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8276

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8276

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8276

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8276

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8276

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8276

commit: 0cdd2a7

alexisintech and others added 4 commits May 27, 2026 15:12
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…orts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@manovotny
Copy link
Copy Markdown
Contributor

manovotny commented May 28, 2026

Pushed some changes directly in 9be16f7.

  • Broadened typedoc:generate cache inputs in turbo.json to .typedoc/**/*.mjs so edits to custom-plugin.mjs, custom-router.mjs, custom-theme.mjs, and prepare-markdown-renderer.mjs invalidate the cache.
  • Dropped the export on commentContainsTodo in .typedoc/comment-utils.mjs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@manovotny manovotny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good here, given the incoming changes in #8637 on top of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants