additionalFields type-safety

is it possible to make an additionalField type-safe?
user: {
additionalFields: {
permissions: {
type: "string[]",
required: true,
defaultValue: [""], // NOT TYPE-SAFE
validator: {
input: z.enum(["PERMISSION_1", "PERMISSION_2"]).array(),
output: z.enum(["PERMISSION_1", "PERMISSION_2"]).array()
}
}
}
}
user: {
additionalFields: {
permissions: {
type: "string[]",
required: true,
defaultValue: [""], // NOT TYPE-SAFE
validator: {
input: z.enum(["PERMISSION_1", "PERMISSION_2"]).array(),
output: z.enum(["PERMISSION_1", "PERMISSION_2"]).array()
}
}
}
}
right now i have this but defaultValue and the permissions field on the user object is not type-safe and does not have any intellisense
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?