taylor.prestoT
tRPC3y ago
12 replies
taylor.presto

I am getting a errors after starting a TRPC project with T3. "Unsafe return of an `any` typed value"

It seems like something is off between Prisma and TRPC but I can't figure out why the type infrence isn'y working here.

Anyone run in to this issue before?


import { z } from "zod";
import { db } from "~/server/db";
import {
  createTRPCRouter,
  protectedProcedure,
  publicProcedure,
} from "~/server/api/trpc";

export const certificateRouter = createTRPCRouter({
  create: publicProcedure
    .input(
      z.object({ name: z.string().min(1), description: z.string().min(1) }),
    )
    .mutation(async ({ ctx, input }) => {

      // ERROR HERE: Unsafe assignment of an `any` value.
      const certificate = await db.certificate.create({
        select: {
          id: true,
        },
        data: {
          name: input.name,
          description: input.description,
          certificateId: "1",
          organizationId: "1",
        },
      });

      // ERROR HERE: Unsafe return of an `any` typed value.
      return certificate;
    }),
});
Screenshot_2023-11-18_at_9.37.02_AM.png
Was this page helpful?