Rogue
Rogue
TTCTheo's Typesafe Cult
Created by Rogue on 10/30/2023 in #questions
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
};
}
}
1 replies