- 
                Notifications
    You must be signed in to change notification settings 
- Fork 403
chore(clerk-react,shared,types): Switch to tsc for type generation #5122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for Git ↗︎ 
 | 
| 🦋 Changeset detectedLatest commit: a3e75bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
 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 | 
| !snapshot | 
| Hey @LekoArts - the snapshot version command generated the following package versions: 
 Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.21-snapshot.v20250211113352 --save-exact
 npm i @clerk/backend@1.24.1-snapshot.v20250211113352 --save-exact
 npm i @clerk/chrome-extension@2.2.9-snapshot.v20250211113352 --save-exact
 npm i @clerk/clerk-js@5.52.3-snapshot.v20250211113352 --save-exact
 npm i @clerk/elements@0.22.22-snapshot.v20250211113352 --save-exact
 npm i @clerk/clerk-expo@2.7.7-snapshot.v20250211113352 --save-exact
 npm i @clerk/expo-passkeys@0.1.20-snapshot.v20250211113352 --save-exact
 npm i @clerk/express@1.3.48-snapshot.v20250211113352 --save-exact
 npm i @clerk/fastify@2.1.21-snapshot.v20250211113352 --save-exact
 npm i @clerk/localizations@3.10.6-snapshot.v20250211113352 --save-exact
 npm i @clerk/nextjs@6.11.3-snapshot.v20250211113352 --save-exact
 npm i @clerk/nuxt@1.1.4-snapshot.v20250211113352 --save-exact
 npm i @clerk/clerk-react@5.22.13-snapshot.v20250211113352 --save-exact
 npm i @clerk/react-router@1.0.8-snapshot.v20250211113352 --save-exact
 npm i @clerk/remix@4.4.24-snapshot.v20250211113352 --save-exact
 npm i @clerk/shared@2.21.1-snapshot.v20250211113352 --save-exact
 npm i @clerk/tanstack-start@0.9.6-snapshot.v20250211113352 --save-exact
 npm i @clerk/testing@1.4.22-snapshot.v20250211113352 --save-exact
 npm i @clerk/themes@2.2.18-snapshot.v20250211113352 --save-exact
 npm i @clerk/types@4.45.2-snapshot.v20250211113352 --save-exact
 npm i @clerk/ui@0.3.23-snapshot.v20250211113352 --save-exact
 npm i @clerk/vue@1.1.12-snapshot.v20250211113352 --save-exact | 
| "compilerOptions": { | ||
| "allowSyntheticDefaultImports": true, | ||
| "baseUrl": ".", | ||
| "declaration": true, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already defined in the declarations tsconfig so I removed this duplicate
| "compilerOptions": { | ||
| "allowJs": true, | ||
| "baseUrl": ".", | ||
| "declaration": true, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already defined in the declarations tsconfig so I removed this duplicate
| ".": { | ||
| "import": { | ||
| "types": "./dist/index.d.mts", | ||
| "types": "./dist/index.d.ts", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core of the problem, tsc can't dual emit .d.ts as CJS and .d.mts as ESM so it's only .d.ts for both
| Closing this in favor of a new PR where I'll only create those declaration maps locally/in CI and won't be published | 
Description
TL;DR: Switch some key SDKs to use
tscfor type compilation in order to create sourcemaps for d.ts files (.d.ts.map) so that Typedoc can understand cross-package references.So for my Typedoc project I need to get cross-package references working. So
@clerk/clerk-reactimports from@clerk/sharedwhich in itself imports from@clerk/types. In order to have the type from@clerk/typescorrectly be linked in@clerk/clerk-reactTypedoc needs declaration maps.Which is a problem, because:
tsupdoesn't support generating declaration maps: How to generate .d.ts.map egoist/tsup#564tscdoesn't support dual emit: Dual ESM/CJS emit with tsc microsoft/TypeScript#54593.mjsand.jswith a single.d.ts:FalseCJSproblem - severity and suggested fixes? arethetypeswrong/arethetypeswrong.github.io#21So the current state of the PR will have these problems: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md
The questions now is: Will this have an impact and if yes, do we tolerate it? I've created a snapshot release and will test it but I'd be super open to another approach as long as the result is right 👍
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change