Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Fixing TS error on property 'session' #18

Closed
wants to merge 1 commit into from

Conversation

lucagrandicelli
Copy link

Actually, this configuration throws an error on Next.js 12.3.1^ /w Typescript support:
Type error: Property 'session' does not exist on type '{}'

Since release of Next.js v12.3.0, https://github.com/vercel/next.js/releases#:%7E:text=Compare-,v12.3.0,-Latest the interface AppProps takes a generic for pageProps as shown in the details of this merged PR (vercel/next.js#38867)

Importing the Session type and passing it to the AppProps generic fixes this issue.

Actually, this configuration throws an error on Next.js 12.3.1^ /w Typescript support:
Type error: Property 'session' does not exist on type '{}'

Since release of Next.js v12.3.0, https://github.com/vercel/next.js/releases#:%7E:text=Compare-,v12.3.0,-Latest
the interface AppProps takes a generic for pageProps as shown in the details of this merged PR (vercel/next.js#38867)

Passing a session type to the AppProps generic such as AppProps<{session: Session;}> fixes this issue.
@vercel
Copy link

vercel bot commented Oct 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-auth-typescript-example ❌ Failed (Inspect) Oct 14, 2022 at 3:48PM (UTC)

@lucagrandicelli lucagrandicelli closed this by deleting the head repository Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant