Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/full-times-wear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/types': patch
---

Convert LocalizationResource to interface for typedoc documentation
6 changes: 2 additions & 4 deletions .typedoc/custom-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const LINK_REPLACEMENTS = [
['saml-account', '/docs/references/backend/types/backend-saml-account'],
['web3-wallet', '/docs/references/backend/types/backend-web3-wallet'],
['verify-token-options', '#verify-token-options'],
['localization-resource', '/docs/customization/localization'],
['commerce-subscription-item-resource', '/docs/references/javascript/types/commerce-subscription-item-resource'],
];

/**
Expand Down Expand Up @@ -85,10 +87,6 @@ function getCatchAllReplacements() {
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
Expand Down
24 changes: 12 additions & 12 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,31 +653,31 @@
buildUrlWithAuth(to: string): string;

/**
* Returns the configured url where <SignIn/> is mounted or a custom sign-in page is rendered.
* Returns the configured url where `<SignIn/>` is mounted or a custom sign-in page is rendered.
*
* @param opts A {@link RedirectOptions} object
*/
buildSignInUrl(opts?: RedirectOptions): string;

/**
* Returns the configured url where <SignUp/> is mounted or a custom sign-up page is rendered.
* Returns the configured url where `<SignUp/>` is mounted or a custom sign-up page is rendered.
*
* @param opts A {@link RedirectOptions} object
*/
buildSignUpUrl(opts?: RedirectOptions): string;

/**
* Returns the url where <UserProfile /> is mounted or a custom user-profile page is rendered.
* Returns the url where `<UserProfile />` is mounted or a custom user-profile page is rendered.
*/
buildUserProfileUrl(): string;

/**
* Returns the configured url where <CreateOrganization /> is mounted or a custom create-organization page is rendered.
* Returns the configured url where `<CreateOrganization />` is mounted or a custom create-organization page is rendered.
*/
buildCreateOrganizationUrl(): string;

/**
* Returns the configured url where <OrganizationProfile /> is mounted or a custom organization-profile page is rendered.
* Returns the configured url where `<OrganizationProfile />` is mounted or a custom organization-profile page is rendered.
*/
buildOrganizationProfileUrl(): string;

Expand Down Expand Up @@ -707,7 +707,7 @@
buildAfterMultiSessionSingleSignOutUrl(): string;

/**
* Returns the configured url where <Waitlist/> is mounted or a custom waitlist page is rendered.
* Returns the configured url where `<Waitlist/>` is mounted or a custom waitlist page is rendered.
*/
buildWaitlistUrl(opts?: { initialValues?: Record<string, string> }): string;

Expand All @@ -720,31 +720,31 @@
redirectWithAuth(to: string): Promise<unknown>;

/**
* Redirects to the configured URL where <SignIn/> is mounted.
* Redirects to the configured URL where `<SignIn/>` is mounted.
*
* @param opts A {@link RedirectOptions} object
*/
redirectToSignIn(opts?: SignInRedirectOptions): Promise<unknown>;

/**
* Redirects to the configured URL where <SignUp/> is mounted.
* Redirects to the configured URL where `<SignUp/>` is mounted.
*
* @param opts A {@link RedirectOptions} object
*/
redirectToSignUp(opts?: SignUpRedirectOptions): Promise<unknown>;

/**
* Redirects to the configured URL where <UserProfile/> is mounted.
* Redirects to the configured URL where `<UserProfile/>` is mounted.
*/
redirectToUserProfile: () => Promise<unknown>;

/**
* Redirects to the configured URL where <OrganizationProfile /> is mounted.
* Redirects to the configured URL where `<OrganizationProfile />` is mounted.
*/
redirectToOrganizationProfile: () => Promise<unknown>;

/**
* Redirects to the configured URL where <CreateOrganization /> is mounted.
* Redirects to the configured URL where `<CreateOrganization />` is mounted.
*/
redirectToCreateOrganization: () => Promise<unknown>;

Expand All @@ -764,7 +764,7 @@
redirectToAfterSignOut: () => void;

/**
* Redirects to the configured URL where <Waitlist/> is mounted.
* Redirects to the configured URL where `<Waitlist/>` is mounted.
*/
redirectToWaitlist: () => void;

Expand Down Expand Up @@ -1146,7 +1146,7 @@
*/
windowNavigate: (to: URL | string) => void;
},
) => Promise<unknown> | unknown;

Check warning on line 1149 in packages/types/src/clerk.ts

View workflow job for this annotation

GitHub Actions / Static analysis

'unknown' overrides all other types in this union type

export type WithoutRouting<T> = Omit<T, 'path' | 'routing'>;

Expand Down
4 changes: 3 additions & 1 deletion packages/types/src/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ type DeepLocalizationWithoutObjects<T> = {
* the default english resource object from {@link https://github.com/clerk/javascript Clerk's open source repo}
* as a starting point.
*/
export type LocalizationResource = DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>>;
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Needs to be an interface for typedoc to link correctly
export interface LocalizationResource
extends DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>> {}
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 fixes the type from DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>>

image

To LocalizationResource

Image

And because of the link replacement in .typedoc/custom-plugin.mjs:56 it then points to /docs/customization/localization

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 am not sure if this change from type to interface is ok with just doing an empty changeset, or if this should be a patch

Copy link
Member

Choose a reason for hiding this comment

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

We use it internally in @clerk/clerk-js and @clerk/localizations, but technically it's still public because anyone can import it from @clerk/types for some random reason. So at least a patch changeset would be appropriate 🤔


export type __internal_LocalizationResource = {
locale: string;
Expand Down
Loading