Typing Role
I am using an enum from Prisma
but I cant pass that enum as a type for additional fields
(see image)
is there a way to have it typed as the values of my enum instead of as 'string' ?

9 Replies
probably no
sometimes I forget simple solutions
oh you mean this..
role: {
type: roleEnum("admin"),
required: false,
input: false,
},
i thought u want something like this
i did but its not valid better auth, so this wrapper is relatively safe since all types are directly from better auth except role
yeah it must work good
also make a function for client side
oh good point!
@KHRM @rhitune auth client's useSession can be typed with the additionalFields plugin
TypeScript | Better Auth
Better Auth TypeScript integration.
yes I have this setup, was trying to get to be more verbose on what literal strings a role can be i.e. 'user' , 'mod', 'admin'