Not able to infer fields from extended core User schema

auth.ts:
export const auth = betterAuth({
database: pgPool,
user: {
additionalFields: {
firstName: {
type: "string",
required: false,
},
lastName: {
type: "string",
required: false,
},
},...
export const auth = betterAuth({
database: pgPool,
user: {
additionalFields: {
firstName: {
type: "string",
required: false,
},
lastName: {
type: "string",
required: false,
},
},...
auth-client.ts:
export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
plugins: [inferAdditionalFields<typeof auth>(), anonymousClient()],
});
export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
plugins: [inferAdditionalFields<typeof auth>(), anonymousClient()],
});
Trying to build my app but consistently getting this error:
Type error: Property 'isAnonymous' does not exist on type '{ agencies: {} | null; id: string; name: string; emailVerified: boolean; email: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }'.

17 | });
18 |
> 19 | const isAuthenticatedUser = session?.user && !session.user.isAnonymous;
Type error: Property 'isAnonymous' does not exist on type '{ agencies: {} | null; id: string; name: string; emailVerified: boolean; email: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }'.

17 | });
18 |
> 19 | const isAuthenticatedUser = session?.user && !session.user.isAnonymous;
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?