t3 video tutorial typescript error

I am following along with the official t3 stack video tutorial here. At ~24 min, there is a typescript error in TRPC, and Theo restarts the server, which fixes the problem. I am getting the same problem, but restarting the server doesn't fix the problem. Any ideas?
import { z } from "zod";

import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";

export const postsRouter = createTRPCRouter({
getAll: publicProcedure.query(({ ctx }) => {
return ctx.prisma.post.findMany();
}),
});
import { z } from "zod";

import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";

export const postsRouter = createTRPCRouter({
getAll: publicProcedure.query(({ ctx }) => {
return ctx.prisma.post.findMany();
}),
});
Theo - t3․gg
YouTube
T3 Stack Tutorial - FROM 0 TO PROD FOR $0 (Next.js, tRPC, TypeScrip...
I've never worked this hard on a video before. I really hope y'all can benefit from this 🙏 GITHUB REPO https://github.com/t3dotgg/chirp DEPLOYED APP https://xn--uo8h.t3.gg/ GET A JACKET IF YOU'RE COOL LIKE THAT https://shop.t3.gg/ ALL MY VIDEOS ARE POSTED EARLY ON PATREON https://www.patreon.com/t3dotgg Everything else (Twitch, Twitter, Discor...
13 Replies
Dale
Dale2y ago
This is the error on the ctx.prisma.post.findMany() call
Unsafe return of an `any` typed value.eslint@typescript-eslint/no-unsafe-return
Unsafe return of an `any` typed value.eslint@typescript-eslint/no-unsafe-return
Diogo
Diogo2y ago
Run prisma generate and restart vs code
Dale
Dale2y ago
npm install isn’t enough?
Diogo
Diogo2y ago
What do you mean?
Dale
Dale2y ago
Somewhere in the video, Theo mentioned that you can just run npm install in place of prisma generate to sync up the database sometimes But not really sure why
Diogo
Diogo2y ago
Hmmmmm, that's odd, npm install is an npm command, the only thing it does is install , literally, you can't just change what it does. For the contrary, on the package.json under scripts you can make one that when you let's say, run dev, it generates the schema first and then run the build
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
arete
arete2y ago
im still confused when theo use SSG on username, what does he trying to achived and should i use that to on my projects?
rbatsenko
rbatsenko2y ago
@Dale if you have postinstall script in package.json, you can npm install and then it will automatically run what you put in that script 🙂 I do it in my project.
"scripts": {
"postinstall": "npx prisma generate"
}
"scripts": {
"postinstall": "npx prisma generate"
}
Maybe that's why he told so But forgot to mention this postinstall or smth
smolensk
smolensk2y ago
am experiencing the same issue i run both npx prisma generate npm prisma db push npm install i even tried in WebStorm it's completely broken
rocawear
rocawear2y ago
api.posts.getAll.useQuery()
smolensk
smolensk2y ago
oh ty
Dale
Dale2y ago
Oh I do have that. It looks like I just needed to restart VSCode Thanks!
Want results from more Discord servers?
Add your server