NextAuth Session Typescript checks
My project uses : tRPC, NextJS page router, NextAuth (T3 stack), RecoilJS (state management)
In my components there is this logic that I have to write everytime to satisfy typescript, whenever I am using useSession from NextAuth
I was wondering if there was something I could do so that I dont have to do this without forcing the type in.
An idea I had was using a getServerSideProp on my home page and there I can check for user session and then passing the component session data where it will be of type Session only, and then passing it to the required prop. But then it will lead to prop drilling and I dont want that. Though I am using a state management library RecoilJS. I cant think of the best way.
Can I get some recommendations of what you guys like to do in cases like this?
0 Replies