Skip to content

Commit 140d334

Browse files
committed
change approach to jsdoc @deprecated notice
1 parent 7e031ec commit 140d334

4 files changed

Lines changed: 3 additions & 40 deletions

File tree

.changeset/auth-misimport-runtime-error.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@clerk/nextjs": patch
33
---
44

5-
Improved error message when `auth` is accidentally imported from `@clerk/nextjs` instead of `@clerk/nextjs/server`. Previously, bundlers would show a generic `'auth' is not exported` error. Now, a clear runtime error points developers to the correct import path.
5+
Improved developer experience when `auth` is accidentally imported from `@clerk/nextjs` instead of `@clerk/nextjs/server`. The `auth` export now includes a `@deprecated` JSDoc tag with a clear message guiding developers to the correct import path, visible on hover in IDEs.

packages/nextjs/src/__tests__/auth-misimport.test.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/nextjs/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const ClerkProvider = ComponentsModule.ClerkProvider as ServerComponentsS
8585
export const Show = ComponentsModule.Show as ServerComponentsServerModuleTypes['Show'];
8686

8787
/**
88-
* `auth` is not available from this import path.
88+
* @deprecated `auth()` must be imported from `@clerk/nextjs/server`, not `@clerk/nextjs`.
8989
*
9090
* **To fix this error:**
9191
* ```diff
@@ -96,4 +96,4 @@ export const Show = ComponentsModule.Show as ServerComponentsServerModuleTypes['
9696
* The `auth` function is only available in server-side contexts:
9797
* API Routes, Server Components, Server Actions, and Middleware.
9898
*/
99-
export { auth } from './server-only-stubs';
99+
export declare const auth: never;

packages/nextjs/src/server-only-stubs.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)