Extend user object in auth.ts

Is there a way to extend the user object in the auth.ts file? I've tried extending it but it's not working. Wasn't sure if by doing this it would just automagically extend when it found these properties? Any help is much appreciated! Thanks I'm using the latest Create T3 stack and using NextAuth.js
declare module "next-auth" {
interface Session extends DefaultSession {
user: DefaultSession["user"] & {
id: string;
dob?: Date; // EXTEND FROM USER MODEL
completedOnboarding: boolean; // EXTEND FROM USER MODEL
role: string; // EXTEND FROM USER MODEL
};
}
}
declare module "next-auth" {
interface Session extends DefaultSession {
user: DefaultSession["user"] & {
id: string;
dob?: Date; // EXTEND FROM USER MODEL
completedOnboarding: boolean; // EXTEND FROM USER MODEL
role: string; // EXTEND FROM USER MODEL
};
}
}
0 Replies
No replies yetBe the first to reply to this messageJoin