Skip to content

Commit 837692a

Browse files
chore(clerk-react,types): Update Typedoc for hooks and <ClerkProvider> (#5643)
Co-authored-by: LekoArts <lekoarts@gmail.com>
1 parent 0c00e59 commit 837692a

12 files changed

Lines changed: 39 additions & 24 deletions

File tree

.changeset/pretty-wasps-press.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@clerk/backend': patch
3+
'@clerk/shared': patch
4+
'@clerk/clerk-react': patch
5+
'@clerk/types': patch
6+
---
7+
8+
Improve JSDoc comments

.typedoc/custom-plugin.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ function getCatchAllReplacements() {
8080
pattern: /\(CreateOrganizationParams\)/g,
8181
replace: '([CreateOrganizationParams](#create-organization-params))',
8282
},
83+
{
84+
pattern: /\| `SignInResource` \|/,
85+
replace: '| [SignInResource](/docs/references/javascript/sign-in) |',
86+
},
8387
{
8488
/**
8589
* By default, `@deprecated` is output with `**Deprecated**`. We want to add a full stop to it.

packages/backend/src/api/endpoints/InstanceApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ type UpdateOrganizationSettingsParams = {
5252
adminDeleteEnabled?: boolean | null | undefined;
5353
domainsEnabled?: boolean | null | undefined;
5454
/**
55-
* Specify which enrollment modes to enable for your Organization Domains.
55+
* Specifies which [enrollment modes](https://clerk.com/docs/organizations/verified-domains#enrollment-mode) to enable for your Organization Domains.
5656
*
5757
* @remarks Supported modes are 'automatic_invitation' & 'automatic_suggestion'.
5858
*/
5959
domainsEnrollmentModes?: Array<string> | undefined;
6060
/**
61-
* Specify what the default organization role is for an organization creator.
61+
* Specifies what the default organization role is for an organization creator.
6262
*/
6363
creatorRoleId?: string | null | undefined;
6464
/**
65-
* Specify what the default organization role is for the organization domains.
65+
* Specifies what the default organization role is for the organization domains.
6666
*/
6767
domainsDefaultRoleId?: string | null | undefined;
6868
};

packages/react/src/hooks/useAuth.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,25 @@ import { invalidStateError } from '../errors/messages';
1717
import { useAssertWrappedByClerkProvider } from './useAssertWrappedByClerkProvider';
1818
import { createGetToken, createSignOut } from './utils';
1919

20-
type Nullish<T> = T | undefined | null;
21-
type InitialAuthState = Record<string, any>;
2220
/**
2321
* @inline
2422
*/
25-
type UseAuthOptions = Nullish<InitialAuthState | PendingSessionOptions>;
23+
type UseAuthOptions = Record<string, any> | PendingSessionOptions | undefined | null;
2624

2725
/**
2826
* The `useAuth()` hook provides access to the current user's authentication state and methods to manage the active session.
2927
*
28+
* > [!NOTE]
29+
* > To access auth data server-side, see the [`Auth` object reference doc](https://clerk.com/docs/references/backend/types/auth-object).
30+
*
3031
* <If sdk="nextjs">
3132
* By default, Next.js opts all routes into static rendering. If you need to opt a route or routes into dynamic rendering because you need to access the authentication data at request time, you can create a boundary by passing the `dynamic` prop to `<ClerkProvider>`. See the [guide on rendering modes](https://clerk.com/docs/references/nextjs/rendering-modes) for more information, including code examples.
3233
* </If>
3334
*
3435
* @unionReturnHeadings
3536
* ["Initialization", "Signed out", "Signed in (no active organization)", "Signed in (with active organization)"]
3637
*
37-
* @param [initialAuthStateOrOptions] - An object containing the initial authentication state. If not provided, the hook will attempt to derive the state from the context.
38+
* @param [initialAuthStateOrOptions] - An object containing the initial authentication state or options for the `useAuth()` hook. If not provided, the hook will attempt to derive the state from the context. `treatPendingAsSignedOut` is a boolean that indicates whether pending sessions are considered as signed out or not. Defaults to `true`.
3839
*
3940
* @function
4041
*

packages/react/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ declare global {
2424
export type IsomorphicClerkOptions = Without<ClerkOptions, 'isSatellite'> & {
2525
Clerk?: ClerkProp;
2626
/**
27-
* Define the URL that `@clerk/clerk-js` should be hot-loaded from
27+
* The URL that `@clerk/clerk-js` should be hot-loaded from.
2828
*/
2929
clerkJSUrl?: string;
3030
/**
3131
* If your web application only uses [Control Components](https://clerk.com/docs/components/overview#control-components), you can set this value to `'headless'` and load a minimal ClerkJS bundle for optimal page performance.
3232
*/
3333
clerkJSVariant?: 'headless' | '';
3434
/**
35-
* Define the npm version for `@clerk/clerk-js`
35+
* The npm version for `@clerk/clerk-js`.
3636
*/
3737
clerkJSVersion?: string;
3838
/**

packages/shared/src/react/hooks/useOrganization.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type UseOrganizationParams = {
3232
* If set to `true`, all default properties will be used.<br />
3333
* Otherwise, accepts an object with the following optional properties:
3434
* <ul>
35-
* <li>`enrollmentMode`: A string that filters the domains by the provided enrollment mode.</li>
35+
* <li>`enrollmentMode`: A string that filters the domains by the provided [enrollment mode](https://clerk.com/docs/organizations/verified-domains#enrollment-mode).</li>
3636
* <li>Any of the properties described in [Shared properties](#shared-properties).</li>
3737
* </ul>
3838
*/
@@ -69,7 +69,7 @@ export type UseOrganizationParams = {
6969
* If set to `true`, all default properties will be used.<br />
7070
* Otherwise, accepts an object with the following optional properties:
7171
* <ul>
72-
* <li>`status`: A string that filters the subscriptions by the provided status.</li>
72+
* <li>`orgId`: A string that filters the subscriptions by the provided organization ID.</li>
7373
* <li>Any of the properties described in [Shared properties](#shared-properties).</li>
7474
* </ul>
7575
*/

packages/types/src/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export type UseSessionReturn =
180180
*/
181181
isSignedIn: undefined;
182182
/**
183-
* Holds the current active session for the user.
183+
* The current active session for the user.
184184
*/
185185
session: undefined;
186186
}
@@ -233,7 +233,7 @@ export type UseUserReturn =
233233
*/
234234
isSignedIn: undefined;
235235
/**
236-
* The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
236+
* The `User` object for the current user.
237237
*/
238238
user: undefined;
239239
}

packages/types/src/localization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type LocalizationValue = string;
55

66
/**
77
* A type containing all the possible localization keys the prebuilt Clerk components support.
8-
* Users aiming to customise a few strings can also peak at the `data-localization-key` attribute by inspecting
8+
* Users aiming to customize a few strings can also peak at the `data-localization-key` attribute by inspecting
99
* the DOM and updating the corresponding key.
1010
* Users aiming to completely localize the components by providing a complete translation can use
1111
* the default english resource object from {@link https://github.com/clerk/javascript Clerk's open source repo}

packages/types/src/multiDomain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { ClerkOptions } from './clerk';
1111
export type MultiDomainAndOrProxy =
1212
| {
1313
/**
14-
* Whether the application is a satellite application.
14+
* A boolean that indicates whether the application is a satellite application.
1515
*/
1616
isSatellite?: never;
1717
/**
@@ -37,7 +37,7 @@ export type MultiDomainAndOrProxy =
3737
export type MultiDomainAndOrProxyPrimitives =
3838
| {
3939
/**
40-
* Whether the application is a satellite application.
40+
* A boolean that indicates whether the application is a satellite application.
4141
*/
4242
isSatellite?: never;
4343
/**

packages/types/src/redirects.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export type AfterSignOutUrl = {
99

1010
export type AfterMultiSessionSingleSignOutUrl = {
1111
/**
12-
* Full URL or path to navigate to after signing out the current user is complete.
13-
* This option applies to multi-session applications.
12+
* The full URL or path to navigate to after signing out the current user is complete.
13+
* This option applies to [multi-session applications](https://clerk.com/docs/authentication/configuration/session-options#multi-session-applications).
1414
*/
1515
afterMultiSessionSingleSignOutUrl?: string | null;
1616
};
@@ -45,14 +45,14 @@ export type RedirectOptions = SignInForceRedirectUrl &
4545

4646
export type AuthenticateWithRedirectParams = {
4747
/**
48-
* Full URL or path to the route that will complete the OAuth or SAML flow.
48+
* The full URL or path to the route that will complete the OAuth or SAML flow.
4949
* Typically, this will be a simple `/sso-callback` route that calls `Clerk.handleRedirectCallback`
5050
* or mounts the <AuthenticateWithRedirectCallback /> component.
5151
*/
5252
redirectUrl: string;
5353

5454
/**
55-
* Full URL or path to navigate to after the OAuth or SAML flow completes.
55+
* The full URL or path to navigate to after the OAuth or SAML flow completes.
5656
*/
5757
redirectUrlComplete: string;
5858

@@ -94,7 +94,7 @@ export type RedirectUrlProp = {
9494

9595
export type SignUpForceRedirectUrl = {
9696
/**
97-
* If provided, this URL will always be redirected to after the user signs up. It's recommended to use the [environment variable](https://clerk.com/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects) instead.
97+
* This URL will always be redirected to after the user signs up. It's recommended to use the [environment variable](https://clerk.com/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects) instead.
9898
*/
9999
signUpForceRedirectUrl?: string | null;
100100
};
@@ -117,7 +117,7 @@ export type SignInFallbackRedirectUrl = {
117117

118118
export type SignInForceRedirectUrl = {
119119
/**
120-
* If provided, this URL will always be redirected to after the user signs in. It's recommended to use the [environment variable](https://clerk.com/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects) instead.
120+
* This URL will always be redirected to after the user signs in. It's recommended to use the [environment variable](https://clerk.com/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects) instead.
121121
*/
122122
signInForceRedirectUrl?: string | null;
123123
};

0 commit comments

Comments
 (0)