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
Navaneeth
Navaneeth2y ago
hm... its supposed to. tried prisma generate ?
barry
barry2y ago
typescript not being set to strict
functionthatreturnsfalse
i think it already is
functionthatreturnsfalse
I ran npx prisma generate, am I missing something here?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
functionthatreturnsfalse
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 now
Prisma | NextAuth.js
To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate @next-auth/prisma-adapter package:
functionthatreturnsfalse
I will refactor my code a little and report back if it works yep, it worked,I guess I initialized prisma incorrectly.
Want results from more Discord servers?
Add your server