Skip to content
Discussion options

You must be logged in to vote

Add the following types/**/*.ts in tsconfig.json:

{ 
  .
  .
  .
  "include": ["next-env.d.ts", "types/**/*.ts", "**/*.ts", "**/*.tsx"],
  .
  .
  .
}

Then add the following for session.user.

types/next-auth.d.ts

import NextAuth from "next-auth"

declare module "next-auth" {
  /**
   * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
   */
  interface Session {
    user: {
      /** The user's name. */
      name: string
    }
  }
}

Replies: 6 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@bhatvikrant
Comment options

Comment options

You must be logged in to vote
8 replies
@bhatvikrant
Comment options

@balazsorban44
Comment options

@bhatvikrant
Comment options

@deadcoder0904
Comment options

@deadcoder0904
Comment options

Answer selected by bhatvikrant
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@memukherjee
Comment options

Comment options

You must be logged in to vote
1 reply
@diego-lipinski-de-castro
Comment options

Comment options

You must be logged in to vote
1 reply
@MrOxMasTer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
9 participants