Skip to content

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Feb 18, 2025

Description

Aligns types between IsomorphicClerk and Clerk to ensure the implementation remains in sync.

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

changeset-bot bot commented Feb 18, 2025

🦋 Changeset detected

Latest commit: a7247a8

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

This PR includes changesets to release 9 packages
Name Type
@clerk/clerk-react Patch
@clerk/chrome-extension Patch
@clerk/elements Patch
@clerk/clerk-expo Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-start Patch
@clerk/ui 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

vercel bot commented Feb 18, 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 Feb 18, 2025 11:15pm

Comment on lines +80 to +85
type WithVoidReturn<F extends (...args: any) => any> = (
...args: Parameters<F>
) => ReturnType<F> extends Promise<infer T> ? Promise<T | void> : ReturnType<F> | void;
type WithVoidReturnFunctions<T> = {
[K in keyof T]: T[K] extends (...args: any) => any ? WithVoidReturn<T[K]> : T[K];
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Most methods were adjust to add | void to the return type, so I've gone ahead and created a helper type to do that automatically.

Comment on lines +88 to +89
WithVoidReturnFunctions<LoadedClerk>,
'client' | '__internal_addNavigationListener' | '__internal_getCachedResources' | '__internal_reloadInitialResources'
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if we need the __internal_ methods here, they don't exist today.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, some of the internals we need some we don't. I know that __internal_addNavigationListener is only needed within clerk-js, which makes me think we can refactor it 🤔.

}

this.premountSignInNodes.forEach((props: SignInProps, node: HTMLDivElement) => {
this.premountSignInNodes.forEach((props, node) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I've also removed unnecessary type annotations and instead am relying on the underlying IsomorphicClerk type definition.

@brkalow brkalow requested a review from a team February 18, 2025 23:28
Copy link
Member

@anagstef anagstef left a comment

Choose a reason for hiding this comment

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

👏

};

handleGoogleOneTapCallback = (
handleGoogleOneTapCallback = async (
Copy link
Member

Choose a reason for hiding this comment

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

🚨 Technically this is a breaking change at the type level.

Copy link
Member Author

Choose a reason for hiding this comment

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

This aligns with the underlying Clerk type I believe 👀

Copy link
Member Author

@brkalow brkalow Feb 19, 2025

Choose a reason for hiding this comment

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

Here: https://github.com/clerk/javascript/blob/main/packages/types/src/clerk.ts#L540-L544

Another reason to ensure these types are sourced from the same place 😅

@panteliselef
Copy link
Member

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @panteliselef - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.0.4-snapshot.v20250219155214
@clerk/astro 2.3.0-snapshot.v20250219155214
@clerk/backend 1.24.3-snapshot.v20250219155214
@clerk/chrome-extension 2.2.11-snapshot.v20250219155214
@clerk/clerk-js 5.54.0-snapshot.v20250219155214
@clerk/elements 0.23.0-snapshot.v20250219155214
@clerk/clerk-expo 2.8.0-snapshot.v20250219155214
@clerk/expo-passkeys 0.1.22-snapshot.v20250219155214
@clerk/express 1.3.50-snapshot.v20250219155214
@clerk/fastify 2.1.23-snapshot.v20250219155214
@clerk/localizations 3.10.8-snapshot.v20250219155214
@clerk/nextjs 6.12.1-snapshot.v20250219155214
@clerk/nuxt 1.2.1-snapshot.v20250219155214
@clerk/clerk-react 5.24.0-snapshot.v20250219155214
@clerk/react-router 1.1.1-snapshot.v20250219155214
@clerk/remix 4.5.1-snapshot.v20250219155214
@clerk/shared 2.23.0-snapshot.v20250219155214
@clerk/tanstack-start 0.10.1-snapshot.v20250219155214
@clerk/testing 1.4.24-snapshot.v20250219155214
@clerk/themes 2.2.20-snapshot.v20250219155214
@clerk/types 4.47.0-snapshot.v20250219155214
@clerk/ui 0.3.25-snapshot.v20250219155214
@clerk/vue 1.3.0-snapshot.v20250219155214

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/agent-toolkit@0.0.4-snapshot.v20250219155214 --save-exact

@clerk/astro

npm i @clerk/astro@2.3.0-snapshot.v20250219155214 --save-exact

@clerk/backend

npm i @clerk/backend@1.24.3-snapshot.v20250219155214 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@2.2.11-snapshot.v20250219155214 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.54.0-snapshot.v20250219155214 --save-exact

@clerk/elements

npm i @clerk/elements@0.23.0-snapshot.v20250219155214 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.8.0-snapshot.v20250219155214 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.1.22-snapshot.v20250219155214 --save-exact

@clerk/express

npm i @clerk/express@1.3.50-snapshot.v20250219155214 --save-exact

@clerk/fastify

npm i @clerk/fastify@2.1.23-snapshot.v20250219155214 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.10.8-snapshot.v20250219155214 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.12.1-snapshot.v20250219155214 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@1.2.1-snapshot.v20250219155214 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.24.0-snapshot.v20250219155214 --save-exact

@clerk/react-router

npm i @clerk/react-router@1.1.1-snapshot.v20250219155214 --save-exact

@clerk/remix

npm i @clerk/remix@4.5.1-snapshot.v20250219155214 --save-exact

@clerk/shared

npm i @clerk/shared@2.23.0-snapshot.v20250219155214 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.10.1-snapshot.v20250219155214 --save-exact

@clerk/testing

npm i @clerk/testing@1.4.24-snapshot.v20250219155214 --save-exact

@clerk/themes

npm i @clerk/themes@2.2.20-snapshot.v20250219155214 --save-exact

@clerk/types

npm i @clerk/types@4.47.0-snapshot.v20250219155214 --save-exact

@clerk/ui

npm i @clerk/ui@0.3.25-snapshot.v20250219155214 --save-exact

@clerk/vue

npm i @clerk/vue@1.3.0-snapshot.v20250219155214 --save-exact

@alexcarpenter alexcarpenter merged commit b707e94 into main Feb 24, 2025
30 checks passed
@alexcarpenter alexcarpenter deleted the brk.chore/isomorphic-clerk-types branch February 24, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants