nextauth session props problem
Hey Guys I have code like that
But I get error: session does not exist on type '{}' How should I fix it?
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
AppType seems to be the culprit.
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>
);
};
NextJS comes with AppProps.
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
Provided your Next version is
^12.3.1
, then this was the AppType I used after doing the manual upgrade by myself.
Here's the full channel thread where I too came across this issue: https://discord.com/channels/966627436387266600/1021624156716015656