What is the improvement or update you wish to see?
next-auth v5 can't module augmentation at next-auth/jwt
Is there any context that might help us understand?
I've identified an error in the "Popular Interfaces to Augment" section of Next.js related to the JWT interface. It appears that the correct import should be @auth/core/jwt rather than next-auth/jwt. This correction is crucial because the jwt.d.ts file in the next-auth package includes a deprecated flag, signaling its replacement in version 5.

To illustrate this issue and its resolution, I've included screenshots:


Furthermore, when using next-auth with pnpm, there might be an issue where it can't locate @auth/core/jwt since it's a dependency of the next-auth package and resides in .pnpm within the node_modules directory. To address this, I've implemented the following solution:
// tsconfig.json
{
"compilerOptions": {
// Other options...
"paths": {
"@auth/core/*" : ["./node_modules/.pnpm/@auth+core@0.18.1/node_modules/@auth/core/*"]
}
// Other options...
}
}
I've also submitted a pull request with these changes (#9563).
Does the docs page already exist? Please link to it.
https://authjs.dev/getting-started/typescript?frameworks=core
What is the improvement or update you wish to see?
next-authv5 can't module augmentation atnext-auth/jwtIs there any context that might help us understand?
I've identified an error in the "Popular Interfaces to Augment" section of Next.js related to the JWT interface. It appears that the correct import should be
@auth/core/jwtrather thannext-auth/jwt. This correction is crucial because thejwt.d.tsfile in thenext-authpackage includes a deprecated flag, signaling its replacement in version 5.To illustrate this issue and its resolution, I've included screenshots:
Furthermore, when using
next-authwithpnpm, there might be an issue where it can't locate@auth/core/jwtsince it's a dependency of thenext-authpackage and resides in.pnpmwithin thenode_modulesdirectory. To address this, I've implemented the following solution:I've also submitted a pull request with these changes (#9563).
Does the docs page already exist? Please link to it.
https://authjs.dev/getting-started/typescript?frameworks=core