Skip to content

docs: fix missing auth.d.ts session types in server dir Nuxt 4#437

Merged
atinux merged 1 commit intoatinux:mainfrom
Eckhardt-D:doc-auth-types
Jul 30, 2025
Merged

docs: fix missing auth.d.ts session types in server dir Nuxt 4#437
atinux merged 1 commit intoatinux:mainfrom
Eckhardt-D:doc-auth-types

Conversation

@Eckhardt-D
Copy link
Copy Markdown
Contributor

When auth.d.ts file is in the root of the project, session types only resolve to the augmentation in the app directory. In server/ the types resolve to the empty interfaces in the session.d.ts file.

This PR documents how to fix that by moving your auth.d.ts file to the shared/ folder in Nuxt v4 or compatibilityVersion 4.

Copy link
Copy Markdown
Owner

@atinux atinux left a comment

Choose a reason for hiding this comment

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

Thank you!

@atinux atinux merged commit 29dd4da into atinux:main Jul 30, 2025
Comment thread README.md
You can define the type for your user session by creating a type declaration file (for example, `auth.d.ts`) in your project to augment the `UserSession` type:

> [!NOTE]
> If you are using Nuxt >=4.0.0 or compatibility version 4 add the `auth.d.ts` file to the `shared` directory to get the correct types in server and client.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

that worked to me

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.

3 participants