fix: type error in portal

This commit is contained in:
Nathnael
2026-07-20 08:25:54 +00:00
committed by Hagernesh
parent 38bccaccf9
commit b67aa813f9

View File

@@ -38,7 +38,16 @@ export const onboardingSchema = z.object({
// fields above are read-only confirmations pulled from eTrade).
// Region is a closed set; zone/woreda/kebele stay free text until the platform
// has an authoritative dataset of Ethiopian zones/woredas/kebeles.
region: z.enum(ETHIOPIAN_REGIONS, { message: "Region is required" }),
//
// Deliberately `.refine` over `z.enum`: the form needs "" as its unselected
// sentinel (default value, and legacy rows whose region isn't in the list). A
// literal union makes "" untypable, which also splits the resolver's
// input/output types and breaks useForm's inference for every other field.
region: z
.string()
.refine((v) => (ETHIOPIAN_REGIONS as readonly string[]).includes(v), {
message: "Region is required",
}),
zone: z.string().min(1, "Zone is required"),
woreda: z.string().min(1, "Woreda is required"),
kebele: z.string().min(1, "Kebele is required"),