nextauth session props problem

Hey Guys I have code like that const MyApp: AppType = ({ Component, pageProps: { session, ...pageProps }, }) => { return ( <SessionProvider session={session}> <Component {...pageProps} /> </SessionProvider> ); };
But I get error: session does not exist on type '{}' How should I fix it?
5 Replies
Christoph
Christoph3y ago
AppType seems to be the culprit.
noctate
noctateOP3y ago
yeah without type it works but I dont know how to make it work with typescript code now: const MyApp = ({ Component, pageProps: { session, ...pageProps } }) => { return ( <SessionProvider session={session}> <Component {...pageProps} /> </SessionProvider> ); };
Christoph
Christoph3y ago
NextJS comes with AppProps.
needmorewood
needmorewood3y ago
run the new version of ct3a in a seprate folder and it will have the new code u need, just copy the relevant AppProps parts presumably u are running intot his issue because of an old version of next being upgraded
Sean Cassiere
Sean Cassiere3y ago
Provided your Next version is ^12.3.1, then this was the AppType I used after doing the manual upgrade by myself.
const MyApp: AppType<{ session: Session | null }> = ({ Component, pageProps: { session, ...pageProps } }) => {
const MyApp: AppType<{ session: Session | null }> = ({ Component, pageProps: { session, ...pageProps } }) => {
Here's the full channel thread where I too came across this issue: https://discord.com/channels/966627436387266600/1021624156716015656
Want results from more Discord servers?
Add your server