David
David14mo ago

standaloneMiddleware: Merge ctx/meta/input types

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: '' } }) you would still want the context type to be merged with the original so your queries and mutations get the complete context.
0 Replies
No replies yetBe the first to reply to this messageJoin