prisma.user.create type is 'any'
I defined the prisma schema, but when i try to add a user to the database, it's type is 'any', isn't prisma supposed to generate type definitions for my schema?
7 Replies
hm... its supposed to. tried prisma generate ?
typescript not being set to strict
i think it already is
I ran
npx prisma generate
, am I missing something here?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
OK, i tried something a bit weird.
At first i was following the nextauth docs for setting up nextauth with Prisma: https://next-auth.js.org/adapters/prisma
The docs mentioned creating this weird
prismadb.ts
file, i copy-pasted it from their docs to my code.
Now, i removed that file and just accessed the prisma
variable as they say so after you run the prisma generate
command
(aka importing PrismaClient
and then const prisma = new PrismaClient()
whereever in the code you want to use prisma)
I did that and the intellisense is working nowPrisma | NextAuth.js
To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate @next-auth/prisma-adapter package:
I will refactor my code a little and report back if it works
yep, it worked,I guess I initialized prisma incorrectly.