omar-dulaimi / trpc-shield

🛡 A tRPC tool to ease the creation of permission layer.
MIT License
402 stars 10 forks source link

Context Extension not correctly typed #21

Open svengau opened 1 year ago

svengau commented 1 year ago

Bug report

Describe the bug

trpc middleware allows extending the context, in particular Context Extension.

See https://trpc.io/docs/server/middlewares#context-extension

To Reproduce

To reproduce, simply;

  1. add the isAuthenticated rule to the official example,
  2. and use it on one query (example findManyUser).
  3. In findManyUser, check ctx.user. It's still null.

Expected behavior

In findManyUser, ctx.user should be typed as a string

ps: Thanks for this awesome job, I come from the graphql world, and really appreciated the graphql-shield.