nextauthjs / nextauthjs/next-auth

Fails to follow next-auth-example repo

Open
#7,467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment

System:
OS: Windows 10 10.0.22621
CPU: (8) x64 Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz
Memory: 7.81 GB / 15.84 GB
Binaries:
Node: 18.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.3.1 - C:\Program Files\nodejs\yarn.CMD
npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.1555.0), Chromium (112.0.1722.68)
Internet Explorer: 11.0.22621.1

Reproduction URL

https://github.com/nextauthjs/next-auth-example/blob/main/pages/_app.tsx

Describe the issue

On app.tsx:

import { SessionProvider } from "next-auth/react"
import "./styles.css"

import type { AppProps } from "next/app"
import type { Session } from "next-auth"

// Use of the <SessionProvider> is mandatory to allow components that call
// `useSession()` anywhere in your application to access the `session` object.
export default function App({
  Component,
  pageProps: { session, ...pageProps },
}: AppProps<{ session: Session }>) {
  return (
    <SessionProvider session={session}>
      <Component {...pageProps} />
    </SessionProvider>
  )
}

it reproduce an error Property 'expires' is missing in type 'import("c:/___/___/next-auth").Session' but required in type 'import("c:/___/___/node_modules/next-auth/core/types").Session'.ts(2741)

How to reproduce

just copy & paste the code to code editor
Notes: I'm using VSCode

Expected behavior

it will not show TypeError

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pages/_app.tsx in the next-auth-example repository and reproduce the TypeScript error in VSCode using the shown SessionProvider and AppProps code. Compare the Session types referenced by the example and the installed next-auth package; done means the example follows the repository code without the missing expires type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.