Created
December 16, 2023 21:18
-
-
Save taylor-lindores-reeves/dd0274d0a86cc17a3b52d40d2d4cfe4c to your computer and use it in GitHub Desktop.
auth.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DefaultSession } from "@auth/core/types"; | |
declare module "@auth/core" { | |
interface Session { | |
user: { | |
email: string; | |
subscribed: boolean; | |
// By default, TypeScript merges new interface properties and overwrite existing ones. In this case, the default session user properties will be overwritten, with the new one defined above. To keep the default session user properties, you need to add them back into the newly declared interface | |
} & DefaultSession["user"]; // To keep the default types | |
} | |
} | |
declare module "@auth/core/adapters" { | |
interface AdapterUser { | |
stripeCustomerId: string; | |
credits: number; | |
} | |
} | |
declare module "next-auth" { | |
/** | |
* Leveraged by session callback's user object (AdapterUser extends User) | |
*/ | |
export interface User extends DefaultUser { | |
stripeCustomerId: string; | |
credits: number; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment