From daadc31874bd1aa919afe6bc13378145d0a3b691 Mon Sep 17 00:00:00 2001 From: Tim Lancina <804331+tlancina@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:48:24 -0700 Subject: [PATCH] fix: more precise Zod refinement types Addresses https://github.com/zenstackhq/zenstack/issues/676. --- packages/schema/src/plugins/zod/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/src/plugins/zod/generator.ts b/packages/schema/src/plugins/zod/generator.ts index 402c43fbc..360d5142c 100644 --- a/packages/schema/src/plugins/zod/generator.ts +++ b/packages/schema/src/plugins/zod/generator.ts @@ -236,7 +236,7 @@ async function generateModelSchema(model: DataModel, project: Project, output: s // compile "@@validate" to ".refine" const refinements = makeValidationRefinements(model); if (refinements.length > 0) { - writer.writeLine(`function refine(schema: z.ZodType) { return schema${refinements.join('\n')}; }`); + writer.writeLine(`function refine(schema: z.ZodType) { return schema${refinements.join('\n')}; }`); } // model schema