Skip to content

Conversation

@LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Jan 31, 2025

Description

Improve and add JSDoc comments to the public API of @clerk/clerk-react to document all client-side helpers (later with Typedoc). Since some of the hooks are in @clerk/shared you'll also see changes there.

Some comments are duplicated and not DRY, unfortunately you can't add a comment to a type alias and use that instead. TypeScript doesn't support that 😢

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:

@vercel
Copy link

vercel bot commented Jan 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 31, 2025 11:25am

@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2025

🦋 Changeset detected

Latest commit: 441254d

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

This PR includes changesets to release 22 packages
Name Type
@clerk/nextjs Patch
@clerk/shared Patch
@clerk/clerk-react Patch
@clerk/types Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue Patch
@clerk/localizations Patch
@clerk/themes 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

Copy link
Contributor Author

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

Comments

* ```tsx
* // app/page.tsx
*
* ```tsx {{ filename: 'app/page.tsx' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed my approach to indicate the filename to what we currently use in the docs. This won't show up in your IDE but we then can later use it in the docs.

*
* ```tsx
* // pages/myServerSidePage.tsx
* ### Basic usage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Realized I can use headings, so switched them to what they'll be in the docs


test('defaults to path routing and a path prop is required', () => {
const TestingComponent = props => {
const TestingComponent = (props: any) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typedoc complained about type errors here, so I fixed those

Comment on lines +36 to +37
* ```
* ```
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This empty code block is on purpose as without it the whole @example block would be interpreted as a code block. Only when you manually add a codeblock the text above is treated as such

};

authenticateWithOKXWallet = async (params: AuthenticateWithOKXWalletParams): Promise<void> => {
authenticateWithOKXWallet = async (params?: AuthenticateWithOKXWalletParams): Promise<void> => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typedoc complained about type errors here, so I fixed those. It's weird that it doesn't happen for other functions above that also have optional params

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to repeat all comments 😢

@LekoArts LekoArts marked this pull request as ready for review January 31, 2025 13:53
@LekoArts LekoArts merged commit 833693a into main Jan 31, 2025
40 checks passed
@LekoArts LekoArts deleted the lekoarts/eco-307-add-typedoc-for-clerkclerk-react branch January 31, 2025 15:01
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.

4 participants