Additional fields missing from User type

I have added 2 additional fields to better auth with this code:
export const auth = betterAuth({
appName: 'Test',
user: {
additionalFields: {
timezone: {
type: 'string',
default: 'UTC',
nullable: false,
},
customerId: {
type: 'string',
default: '',
nullable: false,
},
},
},
export const auth = betterAuth({
appName: 'Test',
user: {
additionalFields: {
timezone: {
type: 'string',
default: 'UTC',
nullable: false,
},
customerId: {
type: 'string',
default: '',
nullable: false,
},
},
},
i'm working only server side, is there something like type Session = typeof auth.$Infer.Session for the User type?
4 Replies
Benfa
BenfaOP6d ago
i'm working on server side so i don't use "createAuthClient" but i use auth directly, which i think should be faster beacuse it shouldn't make any http request since i'm on the server already.
bekacru
bekacru6d ago
Session = typeof auth.$Infer.Session //this includes both `session` and `user` keys
Session = typeof auth.$Infer.Session //this includes both `session` and `user` keys
KiNFiSH
KiNFiSH6d ago
there is a server one right below to it

Did you find this page helpful?