oljimenez
Explore posts from serversNextJS and createProxySSGHelpers context type error
Hi guys, do you guys know a better way of clean this typescript error?
createProxySSGHelpers({
router: appRouter,
ctx: await createContext({
//this cause type error because ctx.req and ctx.res from getServerSideProps or getStaticProps are diferent from NextApiRequest and NextApiResponse
req: ctx.req,
res: ctx.res,
}),
transformer: superjson,
});
i ended doing this
export const trpcServerContext = async (ctx: NextServerContext) =>
createProxySSGHelpers({
router: appRouter,
ctx: await createContext({
req: ctx.req as NextApiRequest,
res: ctx.res as NextApiResponse,
}),
transformer: superjson,
});
but maybe exist a better way.
6 replies