Marksmith
React tsc starts checking server types
My tsconfig files are different on the server and client. When I run "tsc" on react client, It is trying to check AppRouter types from the server. Is it possible to make him stop checking server types on compile?
3 replies
applyWSSHandler yells at context error in express
I used the example code from docs.
My applyWSSHandler code is:
I see the next error on createContext:
The createContext function was copied from examples as well. I just made it to return req and res instead of the empty object:
How should I change the createContext function to make it work? I have a problem while trying to write tests probably because of this too.
1 replies
Creating trpc context (express server) for testing without req and res objects.
I have seen a few examples of tests with next auth or t3 stack that is using next-auth under the hood.
My problem is that I don't understand what should my inner context object contain, because I'm using express server 😦
For example, this is my context and t object. Req and res are mandatory:
Then, my require auth middleware function is:
Of course, I cannot create called with this setup, because, I will need to have req and res object.
It's not possible to use next-auth as well.
If you have any example express trpc testing code, it would be awesome if you showed me how this can be achieved.
If not, the question is:
How do I need to rewrite the context creation and what should the inner context accept and return? Should I get the headers and other data before the inner context?
2 replies