Unsafe return of any typed value, using prisma upsert

Hi all; I'm getting a lot of warnings in my IDE in this code; setTheoryModule: protectedProcedure .input(z.object({ moduleName: z.string(), state: z.boolean() })) .mutation(async ({ input, ctx }) => { const user = ctx.session.user.id; const { moduleName, state } = input; const setTheoryModule = await ctx.prisma.theoryProgress.upsert({ where: { userId: user, moduleName: moduleName, }, create: { userId: user, moduleName: moduleName, state: state, }, update: { state: state, }, }); return setTheoryModule; }), Its saying that "Unsafe assignment of an any value." is the error How do i fix this, and what does the error mean?
14 Replies
Piotrek
Piotrek2y ago
try restarting your typescript server (Ctrl+Shift+P and serach for typescript)
Christian Lind
I've done that! Getting the same error @Piotrek Is there wrong with the code or is it some weird bug? Im also seeing this error in the terminal tRPC failed on theory.setTheoryModule: Cannot read properties of undefined (reading 'upsert')
Piotrek
Piotrek2y ago
have you generated your prisma client?
Christian Lind
Getting the same error here also
Christian Lind
npx prisma generate?
Piotrek
Piotrek2y ago
yeah
Christian Lind
Yes i have, getting same issue... very strange
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Christian Lind
I'm still getting the same error - i have tried restarting absolutley everything
barry
barry2y ago
And if you check the types of ctx.prisma you’re sure it’s not there with some different capitalization?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
clemwo
clemwo17mo ago
Interesting, just had that same error and thought it was my fault since I'm pretty beginner. Restarting VSCode completely now worked fine for me tho
Sybatron
Sybatron17mo ago
why there are 2 different capitalizations in both of them?
sariyanta
sariyanta13mo ago
Don't know if this has been fixed already, but for me restarting the eslint server was the solution.
Want results from more Discord servers?
Add your server