refactor: add trailing commas to zod schema definitions in reactive-watch-demo

This commit is contained in:
Firman Ramdhani
2026-06-15 23:08:46 +07:00
parent f9a6519da4
commit 19066dde89
@@ -31,26 +31,26 @@ export default function ReactiveWatchDemo() {
.and( .and(
z.discriminatedUnion('userType', [ z.discriminatedUnion('userType', [
z.object({ userType: z.literal('PERSONAL') }), z.object({ userType: z.literal('PERSONAL') }),
z.object({ userType: z.literal('CORPORATE'), corporateTaxId: taxIdValidator }) z.object({ userType: z.literal('CORPORATE'), corporateTaxId: taxIdValidator }),
]) ]),
) )
.and( .and(
z.union([ z.union([
z.object({ hasSpouse: z.literal(false) }), z.object({ hasSpouse: z.literal(false) }),
z.object({ hasSpouse: z.literal(true), spouseName: spouseNameValidator }) z.object({ hasSpouse: z.literal(true), spouseName: spouseNameValidator }),
]) ]),
) )
.and( .and(
z.union([ z.union([
z.object({ newsletter: z.literal(false) }), z.object({ newsletter: z.literal(false) }),
z.object({ newsletter: z.literal(true), newsletterEmail: newsletterEmailValidator }) z.object({ newsletter: z.literal(true), newsletterEmail: newsletterEmailValidator }),
]) ]),
) )
.and( .and(
z.union([ z.union([
z.object({ department: z.string().min(1), role: roleValidator }), z.object({ department: z.string().min(1), role: roleValidator }),
z.object({ department: z.union([z.literal(''), z.undefined(), z.null()]).optional() }) z.object({ department: z.union([z.literal(''), z.undefined(), z.null()]).optional() }),
]) ]),
); );
const { control, handleSubmit, setValue, unregister, clearErrors } = useForm<any>({ const { control, handleSubmit, setValue, unregister, clearErrors } = useForm<any>({