diff --git a/types/adapters.d.ts b/types/adapters.d.ts index 0e6e86cc68..0f486fc9a6 100644 --- a/types/adapters.d.ts +++ b/types/adapters.d.ts @@ -204,6 +204,7 @@ declare class TypeORMUserModel implements User { image?: string, emailVerified?: Date ) + [x: string]: unknown } declare class TypeORMSessionModel implements Session { diff --git a/types/index.d.ts b/types/index.d.ts index 44a0cee397..1e54fe84f9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -251,14 +251,16 @@ export interface Account extends TokenSet, Record { type: string } -/** The OAuth profile returned from your provider */ -export interface Profile extends Record { +export interface DefaultProfile { sub?: string name?: string email?: string image?: string } +/** The OAuth profile returned from your provider */ +export interface Profile extends Record, DefaultProfile {} + /** [Documentation](https://next-auth.js.org/configuration/callbacks) */ export interface CallbacksOptions< P extends Record = Profile, @@ -391,6 +393,12 @@ export interface SessionOptions { updateAge?: number } +export interface DefaultUser { + name?: string | null + email?: string | null + image?: string | null +} + /** * The shape of the returned object in the OAuth providers' `profile` callback, * available in the `jwt` and `session` callbacks, @@ -401,11 +409,7 @@ export interface SessionOptions { * [`jwt` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) | * [`profile` OAuth provider callback](https://next-auth.js.org/configuration/providers#using-a-custom-provider) */ -export interface User { - name?: string | null - email?: string | null - image?: string | null -} +export interface User extends Record, DefaultUser {} declare function NextAuth( req: NextApiRequest,