TRPC linting error
im getting this linting error. my trpc implementation is exactry like the docs
2 Replies
i think its something with the context
import { type inferAsyncReturnType } from '@trpc/server';
import { type CreateNextContextOptions } from '@trpc/server/adapters/next';
import { getSession } from 'next-auth/react';
import prisma from '../backend/db/client'
/
* Replace this with an object if you want to pass things to createContextInner
*/
type CreateContextOptions = Record<string, never>;
/ Use this helper for:
* - testing, so we dont have to mock Next.js' req/res
* - trpc's
createSSGHelpers
where we don't have req/res
* @see https://create.t3.gg/en/usage/trpc#-servertrpccontextts
/
export const createContextInner = async (opts: CreateContextOptions) => {
const session = await getSession({ req: opts.req });
return {
session,
prisma,
};
};
/
* This is the actual context you'll use in your router
* @link https://trpc.io/docs/context
**/
export const createContext = async (opts: CreateNextContextOptions) => {
return await createContextInner({});
};
export type Context = inferAsyncReturnType<typeof createContext>;Context | tRPC
Your context holds data that all of your tRPC procedures will have access to, and is a great place to put things like database connections or authentication information.