Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Nov 10, 2025

Description

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:

Summary by CodeRabbit

  • Chores
    • Reorganized internal type definitions across packages to improve code structure and maintainability. No user-facing changes or behavioral updates.

@panteliselef panteliselef self-assigned this Nov 10, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: 9038cc7

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 Nov 10, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Nov 10, 2025 0:39am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request systematically migrates type imports across 100+ files from the @clerk/types package to @clerk/shared/types. Changes span multiple packages (Astro, backend, Expo, Next.js, Nuxt, React Router, and localizations), updating preset configurations, component imports, test files, and localization resource declarations with no behavioral modifications.

Changes

Cohort / File(s) Summary
Integration Presets
integration/presets/astro.ts, integration/presets/next.ts
Updated dependencies: @clerk/types@clerk/shared/types for node configuration; removed deprecation notice in Next.js config.
Integration Templates & Types
integration/templates/next-app-router/src/app/(reverification)/actions.ts, integration/types.d.ts
Updated type import sources for ReverificationConfig and Clerk from @clerk/types@clerk/shared/types.
Astro Components
packages/astro/src/astro-components/(control|interactive|unstyled)/*.astro, packages/astro/src/react/*.tsx, packages/astro/src/internal/*.ts, packages/astro/src/stores/*.ts, packages/astro/src/types.ts, packages/astro/src/integration/create-integration.ts
Bulk migration of type imports for component props and utilities from @clerk/types@clerk/shared/types across control, interactive, and unstyled components.
Backend API Endpoints
packages/backend/src/api/endpoints/\\*Api.ts, packages/backend/src/api/resources/*.ts, packages/backend/src/api/request.ts
Updated type imports for pagination, billing, and resource types (ClerkPaginationRequest, BillingMoneyAmount, OrganizationCustomRoleKey, etc.) from @clerk/types@clerk/shared/types.
Backend Tokens & Auth
packages/backend/src/tokens/*.ts, packages/backend/src/jwt/*.ts, packages/backend/src/createRedirect.ts, packages/backend/src/index.ts
Migrated JWT, authentication, and session-related type imports (JwtPayload, Jwt, PendingSessionOptions, SessionStatusClaim) from @clerk/types@clerk/shared/types.
Expo Hooks & Provider
packages/expo/src/hooks/*.ts, packages/expo/src/cache/*.ts, packages/expo/src/provider/*.ts, packages/expo/src/local-credentials/*.ts
Updated imports for OAuth, SSO, auth hooks, and credential types from @clerk/types@clerk/shared/types.
Localizations (61 files)
packages/localizations/src/*.ts, packages/localizations/src/utils/generate.ts
Bulk migration of LocalizationResource type imports across all supported locales and the generator utility from @clerk/types@clerk/shared/types.
Next.js Components & Utilities
packages/nextjs/src/(app-router|server|client-boundary)/*.tsx, packages/nextjs/src/experimental.ts, packages/nextjs/src/types.ts
Updated type imports for provider, control components, and experimental exports from @clerk/types@clerk/shared/types.
Nuxt Components & Server
packages/nuxt/src/(module.ts|runtime/plugin.ts|runtime/server/*.ts)
Migrated type imports for Nuxt integration including InitialState, PendingSessionOptions, and Without from @clerk/types@clerk/shared/types.
React Router Components
packages/react-router/src/(client|server)/*.tsx, packages/react-router/src/(client|server)/*.ts
Updated type imports for UI components, client utilities, and server middleware from @clerk/types@clerk/shared/types.
Tanstack React Start Components
packages/tanstack-react-start/src/(client|server)/*.ts
Migrated type imports for middleware, types, and UI components from @clerk/types@clerk/shared/types.
Testing Utilities
packages/backend/src/__tests__/*.ts, packages/backend/src/tokens/__tests__/*.ts, packages/expo-passkeys/src/ClerkExpoPasskeys.types.ts, packages/expo/src/cache/dummy-data/*.ts, packages/testing/src/*.ts
Updated type imports in test files and helper utilities from @clerk/types@clerk/shared/types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~20 minutes

This is a high-volume but highly homogeneous refactoring. Nearly every change follows an identical pattern: replacing an import source. The mechanical nature and consistency across files reduce cognitive load. Recommended focus areas:

  • Spot-check 3–5 files from different packages to verify the import paths are consistent
  • Confirm @clerk/shared/types exports all the migrated type symbols
  • Verify integration preset configurations correctly reference the new module paths

Possibly related PRs

Suggested labels

types, refactoring, dependencies

Poem

🐰 From @clerk/types to @clerk/shared, the types now roam,
A hundred files find their new home,
No logic bent, no behavior changed—
Just imports rearranged, clean and arranged! 🎯

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating type imports from @clerk/types to @clerk/shared/types across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 10, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7191

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7191

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7191

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7191

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7191

@clerk/upgrade

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

@clerk/vue

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

commit: 1285045

@panteliselef panteliselef changed the base branch from main to vincent-and-the-doctor November 10, 2025 11:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/expo/src/hooks/useSignInWithApple.ios.ts (1)

6-8: Missing import for SignUpUnsafeMetadata.

The type SignUpUnsafeMetadata is referenced on line 7 but is not imported. This will cause a TypeScript compilation error.

Apply this diff to add the missing import:

-import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
+import type { SetActive, SignInResource, SignUpResource, SignUpUnsafeMetadata } from '@clerk/shared/types';
packages/expo/src/hooks/useSignInWithApple.ts (1)

5-7: Missing import for SignUpUnsafeMetadata.

The type SignUpUnsafeMetadata is referenced on line 6 but is not imported. This will cause a TypeScript compilation error.

Apply this diff to add the missing import:

-import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
+import type { SetActive, SignInResource, SignUpResource, SignUpUnsafeMetadata } from '@clerk/shared/types';
🧹 Nitpick comments (1)
packages/tanstack-react-start/src/server/types.ts (1)

3-10: Consider using type-only import

Since these imports are only used for type composition, consider using import type to make the intent explicit and improve tree-shaking.

Apply this diff:

-import type {
+import type {

Wait, looking more carefully - this already uses import type on line 3. Let me reconsider...

Actually, the import already uses import type syntax. The change looks correct.

LGTM: Type import migration

The migration of these type imports to @clerk/shared/types is correct and maintains proper type-only import syntax.

.addScript('serve', 'pnpm preview')
.addDependency('@clerk/astro', linkPackage('astro'))
.addDependency('@clerk/types', linkPackage('types'))
.addDependency('@clerk/shared', linkPackage('types'))
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify package name and link path consistency

There's a potential mismatch: the package name is @clerk/shared but linkPackage('types') is called, which would resolve to packages/types directory. Based on the PR's goal to migrate from @clerk/types to @clerk/shared, should this be linkPackage('shared') instead?

Run this script to verify the correct package directory:


🏁 Script executed:

#!/bin/bash
# Check if packages/shared or packages/types directory exists and contains the expected types

echo "Checking package directories..."
if [ -d "packages/shared" ]; then
  echo "✓ packages/shared exists"
  ls -la packages/shared/package.json 2>/dev/null && echo "  - has package.json"
fi

if [ -d "packages/types" ]; then
  echo "✓ packages/types exists"
  ls -la packages/types/package.json 2>/dev/null && echo "  - has package.json"
fi

echo -e "\nChecking package names..."
[ -f "packages/shared/package.json" ] && echo "packages/shared name:" && cat packages/shared/package.json | jq -r '.name'
[ -f "packages/types/package.json" ] && echo "packages/types name:" && cat packages/types/package.json | jq -r '.name'

Length of output: 374


The web search didn't provide specific information about the Clerk preset structure. Let me check the actual code in the repository to understand the context better.


🏁 Script executed:

#!/bin/bash
# Examine the astro.ts preset and compare with other presets

echo "=== integration/presets/astro.ts ===" 
cat integration/presets/astro.ts 2>/dev/null || echo "File not found"

echo -e "\n=== Listing other presets ===" 
fd -t f '\.ts$' integration/presets/ 2>/dev/null | head -10

echo -e "\n=== Checking next.ts for reference pattern ===" 
[ -f "integration/presets/next.ts" ] && grep -n "addDependency.*@clerk" integration/presets/next.ts 2>/dev/null | head -10

Length of output: 1428


Fix inconsistent package linkage in astro preset

The dependency linkage is incorrect. Line 14 uses linkPackage('types') which resolves to packages/types (@clerk/types), but should use linkPackage('shared') to match the package name @clerk/shared. Compare with integration/presets/next.ts line 18, which correctly uses linkPackage('shared') for the same dependency.

Change:

.addDependency('@clerk/shared', linkPackage('types'))

To:

.addDependency('@clerk/shared', linkPackage('shared'))
🤖 Prompt for AI Agents
In integration/presets/astro.ts around line 14, the preset incorrectly links
@clerk/shared to linkPackage('types') (resolving to packages/types); change the
dependency linkage to use linkPackage('shared') so @clerk/shared points to
packages/shared, matching the usage in integration/presets/next.ts.

…-package

# Conflicts:
#	integration/presets/astro.ts
#	integration/templates/next-app-router/src/app/(reverification)/actions.ts
#	integration/types.d.ts
#	packages/astro/src/server/clerk-middleware.ts
#	packages/backend/src/tokens/authenticateContext.ts
#	packages/expo/src/hooks/useOAuth.ts
#	packages/expo/src/hooks/useSSO.ts
#	packages/expo/src/local-credentials/useLocalCredentials/useLocalCredentials.ts
#	packages/expo/src/provider/ClerkProvider.tsx
#	packages/nextjs/src/app-router/server/controlComponents.tsx
#	packages/nextjs/src/client-boundary/PromisifiedAuthProvider.tsx
#	packages/nextjs/src/client-boundary/hooks/useEnforceCatchAllRoute.tsx
#	packages/nextjs/src/client-boundary/hooks/useEnforceRoutingProps.tsx
#	packages/nextjs/src/experimental.ts
#	packages/nextjs/src/server/createGetAuth.ts
#	packages/nextjs/src/types.ts
#	packages/react-router/src/client/types.ts
#	packages/react-router/src/client/uiComponents.tsx
#	packages/tanstack-react-start/src/client/types.ts
#	packages/tanstack-react-start/src/client/uiComponents.tsx
@panteliselef panteliselef merged commit 15e5bf0 into vincent-and-the-doctor Nov 10, 2025
32 of 34 checks passed
@panteliselef panteliselef deleted the elef/remove-usage-of-types-package branch November 10, 2025 12:50
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