trpc / v10-playground

tRPC v10 procedure play
https://stackblitz.com/github/trpc/v10-playground?file=src%2Fserver%2Findex.ts,src%2Fclient.ts,src%2Fserver%2Frouters%2FpostRouter.ts&view=editor
13 stars 3 forks source link

Inferring the right error on `contextSwapperMiddleware` #1

Closed KATT closed 2 years ago

KATT commented 2 years ago

Steps to reproduce

  1. Comment out https://github.com/KATT/trpc-procedure-play/blob/b9ea789c7c34e3ca12dea432856158d2c7753873/src/server.ts#L69-L85
  2. Re-enable https://github.com/KATT/trpc-procedure-play/blob/b9ea789c7c34e3ca12dea432856158d2c7753873/src/server.ts#L68

Expected

result at https://github.com/KATT/trpc-procedure-play/blob/b9ea789c7c34e3ca12dea432856158d2c7753873/src/server.ts#L107 should return the UNAUTHORIZED as part of the errors

Actual

result is ResultError | [...]