CreateTRPCNext<AppRouter> showing typescript error.

Hey all, I am having trouble setting up my tRPC
api.ts
api.ts
file. My current
api.ts
api.ts
file looks like this:
import type { AppRouter } from "@acme/api";

function getBaseUrl() {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url

return `http://localhost:3000`; // dev SSR should use localhost
}

export const api = createTRPCNext<AppRouter>({
import type { AppRouter } from "@acme/api";

function getBaseUrl() {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url

return `http://localhost:3000`; // dev SSR should use localhost
}

export const api = createTRPCNext<AppRouter>({
But currently the
AppRouter
AppRouter
type is giving an error saying:
Type 'ErrorFormatter<{ user: User | null; prisma: PrismaClient<PrismaClientOptions, never, DefaultArgs>; }, TRPCErrorShape<number, Record<string, unknown>> & { ...; }>' is not assignable to type 'ErrorFormatter<any, TRPCErrorShape<number, Record<string, unknown>> & { [key: string]: any; }>
Type 'ErrorFormatter<{ user: User | null; prisma: PrismaClient<PrismaClientOptions, never, DefaultArgs>; }, TRPCErrorShape<number, Record<string, unknown>> & { ...; }>' is not assignable to type 'ErrorFormatter<any, TRPCErrorShape<number, Record<string, unknown>> & { [key: string]: any; }>
Which is stopping me from using my api object to run queries and mutations in my next app. I am hoping someone has had this issue before or knows how I can get rid of this error. Thanks. I am using the create-t3 turborepo with expo, next and supabase. I have also attached images of both the
api.ts
api.ts
file and my
root.ts
root.ts
file
No description
No description
2 Replies
shiroyasha9
shiroyasha915mo ago
Can you upload your code on github and share a link so that we can try it locally?
Shampurrrs
ShampurrrsOP14mo ago
GitHub
GitHub - supabase-community/create-t3-turbo: Clean and simple start...
Clean and simple starter repo using the T3 Stack along with Expo React Native and Supabase - GitHub - supabase-community/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with...
Want results from more Discord servers?
Add your server