Skip to content

Commit

Permalink
Merge pull request #47 from esafak/validators
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Sep 19, 2023
2 parents e38ffa9 + eaf4f75 commit 176231e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changeset/support-refined-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"formsnap": patch
---
Fix handling of refined zod schemas so as not to throw false type errors.
5 changes: 4 additions & 1 deletion src/lib/internal/super-form-patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ export type SuperFormOptions<T extends ZodValidation<AnyZodObject>, M> = Partial
}) => MaybePromise<unknown | void>);
dataType: "form" | "json";
jsonChunkSize: number;
validators: SuperValidators<T>;
validators:
| false
| SuperValidators<UnwrapEffects<T>>
| ZodValidation<UnwrapEffects<T>>;
validationMethod: "auto" | "oninput" | "onblur" | "submit-only";
defaultValidator: "keep" | "clear";
customValidity: boolean;
Expand Down
2 changes: 0 additions & 2 deletions src/routes/examples/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ export const simpleFormSchema = z.object({
message: "You need to accept the terms and conditions"
})
});

export type SomeFormSchema = typeof someFormSchema;

0 comments on commit 176231e

Please sign in to comment.