Extend type user

user: {
    changeEmail: {
      enabled: true,
      sendChangeEmailVerification: async ({ newEmail, url }) => {
      ///
      },
    },
    additionalFields: {
      truc_de_con: {
        type: "string",
        nullable: true,
      },
    },


I added an additionalFields but when I import type { User } from "better-auth";
I get only the default form
(alias) type User = {
    id: string;
    name: string;
    email: string;
    emailVerified: boolean;
    createdAt: Date;
    updatedAt: Date;
    image?: string | null | undefined;
}
Solution
Found a quick fix
export type User = typeof auth.$Infer.Session["user"];
adding this in the auth.ts
Was this page helpful?