Skip to content

fix(shared): Add typesVersions fallback for moduleResolution node#7998

Merged
jacekradko merged 2 commits intomainfrom
jacek/shared-types-versions-fallback
Mar 5, 2026
Merged

fix(shared): Add typesVersions fallback for moduleResolution node#7998
jacekradko merged 2 commits intomainfrom
jacek/shared-types-versions-fallback

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Mar 5, 2026

What

Adds a typesVersions field to @clerk/shared/package.json to support TypeScript resolution of @clerk/shared/types under moduleResolution: "node".

Why

@clerk/shared/types is a subpath export that relies on the exports field in package.json. TypeScript only reads exports when moduleResolution is set to "bundler", "node16", or "nodenext". Under the legacy "node" setting, TypeScript ignores exports entirely and fails with:

Cannot find module '@clerk/shared/types' or its corresponding type declarations.

This wasn't an issue when types lived in the standalone @clerk/types package, since that was a top-level import resolved via the types field — which works under all moduleResolution settings.

How

typesVersions acts as a fallback that TypeScript respects under legacy module resolution. By mapping "types" to "dist/types/index.d.ts", TypeScript can resolve @clerk/shared/types regardless of the user's moduleResolution setting.

Testing

Verified locally with a minimal project:

  • moduleResolution: "node"fails without typesVersions, succeeds with it
  • moduleResolution: "bundler" — succeeds in both cases (uses exports)
  • pnpm build and pnpm test pass for @clerk/shared

Summary by CodeRabbit

  • Chores
    • Improved type resolution for the shared package so TypeScript and IDEs can reliably discover and load public type information, enhancing editor support and type checking.
    • Added a changeset entry to mark a patch release that documents this TypeScript resolution improvement.

@vercel
Copy link

vercel bot commented Mar 5, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Mar 5, 2026 7:15pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 75fd7ee

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

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 90dae8c0-4097-4b8c-9fb8-3eef4078378a

📥 Commits

Reviewing files that changed from the base of the PR and between da85099 and 75fd7ee.

📒 Files selected for processing (1)
  • .changeset/shared-types-versions-fallback.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/shared-types-versions-fallback.md

📝 Walkthrough

Walkthrough

The pull request adds a TypeScript type-resolution fallback by introducing a top-level typesVersions entry that maps all exports (*) to dist/types/index.d.ts. It also adds a changeset documenting a patch release for the package. No runtime behavior or exports were changed.

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately describes the main change: adding a typesVersions fallback to fix TypeScript module resolution for the legacy 'node' setting in @clerk/shared.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 5, 2026

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7998

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7998

@clerk/upgrade

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

@clerk/vue

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

commit: 75fd7ee

@jacekradko jacekradko merged commit 09cb6d4 into main Mar 5, 2026
41 checks passed
@jacekradko jacekradko deleted the jacek/shared-types-versions-fallback branch March 5, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants