next-auth
next-auth copied to clipboard
Setting a baseUrl in example app's .tsconfig causes an error in vscode
Question 💬
I want to set a typescript baseUrl so I can do imports relative to the package base instead of the current file, as described here: https://nextjs.org/docs/advanced-features/module-path-aliases
How to reproduce ☕️
- Clone the example app
- Add
"baseUrl": ".",
to the.tsconfig.json
file - View
[...nextauth].ts
in vscode
It's now failing to import the types for NextAuth
.
import NextAuth
This expression is not callable.
Type 'typeof import("/Users/nicholasretallack/Documents/artstream/next-auth")' has no call signatures
Perhaps this is because of the next-auth.d.ts
file?
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
I could not reproduce this. Do you have a repo I can look at?
Yes, this is caused by the next-auth.d.ts file. If you put *.d.ts file inside a directory like types/next-auth.d.ts ad be sure it is included with you ts compiler, things should run fine.
Cause is a module naming conflict overwriting and not extending the Next-Auth Package.
The Next-Auth Documentation recommends putting the any Next-Auth Model Augmentations inside of a types directory and not in the project root directory.
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!
To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!
For anyone having this same problem, I had this problem because I added "next-auth.d.ts" in the include array of the tsconfig.json
file. Remove it and follow @HXavS instructions.