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
try restarting your typescript server (
Ctrl+Shift+P
and serach for typescript)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')
have you generated your prisma client?
Getting the same error here also
npx prisma generate?
yeah
Yes i have, getting same issue...
very strange
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm still getting the same error - i have tried restarting absolutley everything
And if you check the types of ctx.prisma you’re sure it’s not there with some different capitalization?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
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
why there are 2 different capitalizations in both of them?
Don't know if this has been fixed already, but for me restarting the eslint server was the solution.