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
When turning on declararation and declarationMap in the tsconfig.json NextAuth v5 beta 16 will give the following error:
The inferred type of 'auth' cannot be named without a reference to '../node_modules/next-auth/lib'. This is likely not portable. A type annotation is necessary.
The code works perfectly fine in dev mode but will cause build errors during deployment.
The error happens in src/auth.ts in the reproduction repo linked above
How to reproduce
npx create-next-app@latest (enable TypeScript)
npm install next-auth@beta
Create the auth.ts file like the installation guide recommends
Set the declaration and declarationMap to true in the compilerOptions of your tsconfig.json
This repository uses Bun but this error is the same on npm, pnpm with node.js runtime.
Expected behavior
That even with declaration and declarationMap set to true NextAuth should give any issues when using the new auth() function.
The text was updated successfully, but these errors were encountered:
SiebeBaree
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Apr 12, 2024
Environment
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M1
Memory: 63.70 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.1 - /opt/homebrew/bin/node
npm: 10.5.0 - /opt/homebrew/bin/npm
pnpm: 8.15.6 - /opt/homebrew/bin/pnpm
bun: 1.1.3 - ~/.bun/bin/bun
Watchman: 2024.03.25.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 123.1.64.122
Chrome: 123.0.6312.123
Safari: 17.4.1
npmPackages:
next: 13.5.4 => 13.5.4
next-auth: ^5.0.0-beta.16 => 5.0.0-beta.16
react: ^18 => 18.2.0
Reproduction URL
https://github.com/SiebeBaree/declaration-ts-bug-next-auth-v5
Describe the issue
When turning on
declararation
anddeclarationMap
in the tsconfig.json NextAuth v5 beta 16 will give the following error:The code works perfectly fine in dev mode but will cause build errors during deployment.
The error happens in
src/auth.ts
in the reproduction repo linked aboveHow to reproduce
npx create-next-app@latest
(enable TypeScript)npm install next-auth@beta
auth.ts
file like the installation guide recommendsdeclaration
anddeclarationMap
to true in thecompilerOptions
of your tsconfig.jsonThis repository uses Bun but this error is the same on npm, pnpm with node.js runtime.
Expected behavior
That even with
declaration
anddeclarationMap
set to true NextAuth should give any issues when using the newauth()
function.The text was updated successfully, but these errors were encountered: