tRPCttRPC
Powered by
StanleyS
tRPC•3y ago•
4 replies
Stanley

Unsafe return of an `any` typed

I am using TRPC with Prisma. I can't seem to get rid of the TypeScript ESlint error.

import { z } from "zod";

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

export const postRouter = createTRPCRouter({
  getAll: publicProcedure.query(({ ctx }) => {
    return ctx.prisma.post.findMany(); // The error occurs on this line
  }),
});
import { z } from "zod";

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

export const postRouter = createTRPCRouter({
  getAll: publicProcedure.query(({ ctx }) => {
    return ctx.prisma.post.findMany(); // The error occurs on this line
  }),
});


Steps that I have taken:
1. npx primsa db push
2. npm install
3. Restart TypeScript and Eslint in Vscode

I have been trying for hours to get this working, any help will be greatly appreciated.

I am following this tutorial :
https://www.youtube.com/watch?v=YkOSUVzOAA4&t=1525s

up to timeStamp 24:00
YouTubeTheo - t3․gg
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...
T3 Stack Tutorial - FROM 0 TO PROD FOR $0 (Next.js, tRPC, TypeScrip...
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Unsafe assignment of an error typed value
brunubBbrunub / ❓-help
16mo ago
I am getting a errors after starting a TRPC project with T3. "Unsafe return of an `any` typed value"
taylor.prestoTtaylor.presto / ❓-help
3y ago
procedures on routers are typed any
allenwhunAallenwhun / ❓-help
10mo ago