cannot set additional field in sign up body

 const { user: createdUser } = await auth.api.signUpEmail({
        body: {
          email: userData.email,
          password: userData.password,
          name: userData.firstName,
          lastName: userData.lastName,
        },
      });

on lastName -> Type 'string' is not assignable to type 'never'.ts(2322)

Type def of signUpEmail ->
(property) signUpEmail: <false, false>(inputCtx_0: {
    body: ({
        name: string;
        email: string;
        password: string;
        image?: string | undefined;
        callbackURL?: string | undefined;
        rememberMe?: boolean | undefined;
    } | ({
        name: string;
        email: string;
        password: string;
        image?: string | undefined;
        callbackURL?: string | undefined;
        rememberMe?: boolean | undefined;
    } & {} & {})) & {
        lastName: never;
    } & {
        lastName?: null | undefined;
    };
} & {
    method?: "POST" | undefined;
} & {
    query?: Record<string, any> | undefined;
} & {
    params?: Record<string, any>;
} & {
    request?: Request;
} & {
    headers?: HeadersInit;
} & {
    asResponse?: boolean;
    returnHeaders?: boolean;
    use?: Middleware[];
    path?: string;
} & {
    ...;
}) => Promise<...>


You can see that the lastName type is never.

auth.ts is added in the comments below.


Version: 1.3.26
image.png
Solution
Oh seems like it is fixed in v1.3.31.
I was stuck in v1.3.26 because
typeof auth.$Infer.Session; <- this had stopped working. This is also fixed in the new version, so I can upgrade now
Was this page helpful?