docs: Change role type from string to enum values

The example for the additional "role" field now uses an array instead of a raw string. This comes very handy when one is already using an enum-like DB schema (like `pgEnum`) and Drizzle for better type inference.

By the way, I found out that this is allowed by accident from this test, so I am not even sure that this is the intended usage.
 
https://github.com/better-auth/better-auth/pull/5287/files#diff-b98623fbecefef5313e8c1fe082f4895ee707cea0183c5cf4f860942cf3d0e3e
This commit is contained in:
Bennett Dams
2025-12-18 04:37:11 +01:00
committed by GitHub
parent e973bd95be
commit 37ae4ea659

View File

@@ -406,7 +406,7 @@ export const auth = betterAuth({
user: {
additionalFields: {
role: {
type: "string",
type: ["user", "admin"],
required: false,
defaultValue: "user",
input: false, // don't allow user to set role