Using standaloneMiddleware, it would be great to merge the types (ctx, input, meta) with what is already there when passing that middleware.
In our case:
experimental_standaloneMiddleware<{ ctx: { user: { id: number } } }>()
experimental_standaloneMiddleware<{ ctx: { user: { id: number } } }>()
this is because we want to be sure user.id exists in the context before allowing the usage of this middleware, but when returning like this: next({ ctx: { ...ctx, newProp: '' } })next({ ctx: { ...ctx, newProp: '' } }) you would still want the context type to be merged with the original so your queries and mutations get the complete context.
No replies yet
Join the Discord to continue the conversation
t
tRPC
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.