I am a DevI
tRPC3y ago
1 reply
I am a Dev

Should i use lint rule explicit-function-return-type when use trpc?

I got warning for this lint https://typescript-eslint.io/rules/explicit-function-return-type/

When use trpc should I use it?

For example here like this https://github.com/trpc/examples-next-prisma-starter/blob/e5cba42d56514bd633e4f0c83c10f4eb253dd45a/src/server/context.ts#L14

export function createInnerTRPCContext(
  _opts: CreateContextOptions,
) {
  return {};
}

export type Context = inferAsyncReturnType<typeof CreateContextOptions>;


I can define the type like this
export interface Context {}


export function createInnerTRPCContext(_opts: CreateContextOptions): Context {
  return {};
}


but suddenly there are times when it must be inferred, I don't know yet.

I want to know if I should deactivate it or leave it active as I normally do.

thank you
image.png
Was this page helpful?