tRPC middleware

I tried doing what I saw here, but since t3 is typescript it doesn’t allow null. Has anyone done something like this?
4 Replies
barry
barry2y ago
Typescript allows null idk what you mean Jack is literally using typescript in this video? This is for express too? Why would you do this with the t3 stack
darrellf
darrellf2y ago
I attempted the null just like his using the t3 stack , but it just says createContext can't be of that type. I like seeing the endpoints have json objects, so just wanted to try it ou
cje
cje2y ago
this should work
cje
cje2y ago
you can see on line 8 on the right, the type of createTRPCContext gets inferred so if you leave that unchanged, but change context to () => {} or whatever in your route handler, the types will be mismatched and it will complain
Want results from more Discord servers?
Add your server