What's the type of errorFormatter parameter
I wanna know how could i get the type of the errorFormatter parameter, so i can move the errorFormatter logic to another file.
Environment: Node v18.15.0
Environment: Node v18.15.0
ErrorFormatter<Context, DefaultErrorShape>@trpc/server/dist/error/formatter// `Context` is basically `inferAsyncReturnType<typeof createContext>`
export const errorFormatter: ErrorFormatter<Context, DefaultErrorShape> = opts => {
/** do your things, maybe replace DefaultErrorShape */
return opts.shape
}import { DefaultErrorData, ErrorFormatter } from '@trpc/server/dist/error/formatter'
import { TRPCErrorShape } from '@trpc/server/dist/rpc'
import { TRPC_ERROR_CODE_NUMBER } from '@trpc/server/http'
import { typeToFlattenedError, ZodError } from 'zod'
import { Context } from './trpcCore'
interface CustomErrorShape
extends TRPCErrorShape<
TRPC_ERROR_CODE_NUMBER,
/** eslint-disable-next-line @typescript-eslint/no-explicit-any */
DefaultErrorData & { zodError: typeToFlattenedError<any, string> | null }
> {
message: string
code: TRPC_ERROR_CODE_NUMBER
}