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
Christian LindOP2y ago
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
Christian LindOP2y ago
Getting the same error here also
Christian Lind
Christian LindOP2y ago
npx prisma generate?
Piotrek
Piotrek2y ago
yeah
Christian Lind
Christian LindOP2y ago
Yes i have, getting same issue... very strange
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Christian Lind
Christian LindOP2y ago
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
clemwo2y 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
Sybatron2y ago
why there are 2 different capitalizations in both of them?
sariyanta
sariyanta15mo 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