inferAdditionalFields doesnt work?

Im trying to use authClient.signUp.email function on client side. But i cant see my Additional fields on client side. I can see them on server side.

auth-client.ts

import { inferAdditionalFields } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";
import type { auth } from "./auth";
 
export const authClient = createAuthClient({
  plugins: [inferAdditionalFields<typeof auth>()]
});


auth.ts

import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "@/db"; // your drizzle instance
 
export const auth = betterAuth({
    user: {
        additionalFields: {
            role : {
                type : "string",
                required: true,
                defaultValue: "user",
                input : false
            },
            firstName : {
                type : "string",
                required: true,
                defaultValue: "",
                input : true
            },
            lastName : {
                type : "string",
                required: true,
                defaultValue: "",
                input : true
            },
            phone : {
                type : "string",
                required: true,
                defaultValue: "",
                input : true
            },
        }
    },
    database: drizzleAdapter(db, {
        provider: "pg",
    }),
    emailAndPassword :{
        enabled : true
    },
    socialProviders: {
        google : {
            clientId : process.env.GOOGLE_CLIENT_ID!,
            clientSecret : process.env.GOOGLE_CLIENT_SECRET!
        }
    }
});


sign up page

const { data , error }= await authClient.signUp.email({
      firstName : signUpData.firstName,
      lastName : signUpData.lastName,
      email : signUpData.email,
      password : signUpData.password,
      phone : signUpData.phone
 })
Was this page helpful?