Skip to content

Can't extend JWT interface? #4920

Answered by jozefhruska
zanzlender asked this question in Help
Discussion options

You must be logged in to vote

The JWT type is not exported from next-auth, but next-auth/jwt. Could you try it like this?

declare module 'next-auth/jwt' {
  /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
  interface JWT {
    user?: {
       name: string;
       sex: string;
    };
  }
}

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by zanzlender
Comment options

You must be logged in to vote
7 replies
@mamlzy
Comment options

@mamlzy
Comment options

@SornchaiTheDev
Comment options

@pete-willard
Comment options

@joshuaballoch
Comment options

Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
question Ask how to do something or how something works TypeScript Issues relating to TypeScript
8 participants
Converted from issue

This discussion was converted from issue #4919 on July 13, 2022 12:09.