MaksM
tRPCβ€’2y agoβ€’
1 reply
Maks

experimental_nextAppDirCaller ERROR

Hey y'all πŸ™‚

I'm reading new blog post by @julius about TRCP with Next Server Actions approach.
Was following the steps to use

.experimental_caller(experimental_nextAppDirCaller({}))


Here is my procedure:
const nextProcedure = t.procedure
  .use(tracing({ collectInput: true, collectResult: true }))
  .use(async ({ ctx, next }) => {
    // Injecting context
    const log = ctx.log
    const start = Date.now()
    const res = await next({ ctx: { ...ctx, log } })
    const duration = Date.now() - start

    if (res.ok) log.info({ duration, result: res.data })
    else log.error({ duration, error: res.error })

    return res
  })
  .experimental_caller(experimental_nextAppDirCaller({}))

Wanted to ask why is it causing this error?

Argument of type '{}' is not assignable to parameter of type '{ normalizeFormData?: boolean | undefined; onError?: ((opts: ErrorHandlerOptions<{ db: PostgresJsDatabase<{ Post: PgTableWithColumns<{ name: "post"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "post"; dataType: "string"; columnType: "PgUUID"; ... 5 more ...; baseColumn: never; }, {}, {}>; tit...'.
  Property 'createContext' is missing in type '{}' but required in type '{ normalizeFormData?: boolean | undefined; onError?: ((opts: ErrorHandlerOptions<{ db: PostgresJsDatabase<{ Post: PgTableWithColumns<{ name: "post"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "post"; dataType: "string"; columnType: "PgUUID"; ... 5 more ...; baseColumn: never; }, {}, {}>; tit...'.ts(2345)

rootConfig.d.ts(76, 5): 'createContext' is declared here.


As in the example createContext is not passed anywhere, but its required by the experimental_nextAppDirCaller func..
Was this page helpful?