You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
typesVersionsfield to@clerk/shared/package.jsonto support TypeScript resolution of@clerk/shared/typesundermoduleResolution: "node".Why
@clerk/shared/typesis a subpath export that relies on theexportsfield inpackage.json. TypeScript only readsexportswhenmoduleResolutionis set to"bundler","node16", or"nodenext". Under the legacy"node"setting, TypeScript ignoresexportsentirely and fails with:This wasn't an issue when types lived in the standalone
@clerk/typespackage, since that was a top-level import resolved via thetypesfield — which works under allmoduleResolutionsettings.How
typesVersionsacts as a fallback that TypeScript respects under legacy module resolution. By mapping"types"to"dist/types/index.d.ts", TypeScript can resolve@clerk/shared/typesregardless of the user'smoduleResolutionsetting.Testing
Verified locally with a minimal project:
moduleResolution: "node"— fails withouttypesVersions, succeeds with itmoduleResolution: "bundler"— succeeds in both cases (usesexports)pnpm buildandpnpm testpass for@clerk/sharedSummary by CodeRabbit