Why do we do Session module-augmentation on both next.auth.d.ts and server/auth.ts

What's the difference between the two?
//In next.auth.d.ts we have:
declare module "next-auth" {
interface Session {
user: User & {
id: string;
};
}
}

//In server/auth.ts
declare module "next-auth" {
interface Session extends DefaultSession {
user: {
id: string;
// ...other properties
// role: UserRole;
} & DefaultSession["user"];
}
}
//In next.auth.d.ts we have:
declare module "next-auth" {
interface Session {
user: User & {
id: string;
};
}
}

//In server/auth.ts
declare module "next-auth" {
interface Session extends DefaultSession {
user: {
id: string;
// ...other properties
// role: UserRole;
} & DefaultSession["user"];
}
}
What's the purpose of the global next.auth.d.ts if we already have the augmented Session in the auth?
0 Replies
No replies yetBe the first to reply to this messageJoin