Skip to content

Commit

Permalink
Bugfix: Supply types
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisSigrist committed May 11, 2023
1 parent 797dbc5 commit d7e9bd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-poets-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"zocker": patch
---

fix: Fixed wrong type-definitions when using supply or override
12 changes: 6 additions & 6 deletions src/lib/zocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class Zocker<Z extends z.ZodSchema> {
* @param schema - The schema for which this value will be used
* @param generator - A value, or a function that generates a value that matches the schema
*/
supply<Z extends z.ZodTypeAny>(
schema: Z,
generator: Generator<Z> | z.infer<Z>
supply<S extends z.ZodTypeAny>(
schema: S,
generator: Generator<S> | z.infer<S>
) {
const next = this.clone();

Expand All @@ -124,9 +124,9 @@ class Zocker<Z extends z.ZodSchema> {
* @param schema - Which schema to override. E.g: `z.ZodNumber`.
* @param generator - A value, or a function that generates a value that matches the schema
*/
override<Z extends z.ZodFirstPartySchemaTypes>(
schema: Z,
generator: Generator<Z> | z.infer<Z>
override<S extends z.ZodFirstPartySchemaTypes>(
schema: S,
generator: Generator<S> | z.infer<S>
) {
const next = this.clone();
const generator_function =
Expand Down

0 comments on commit d7e9bd0

Please sign in to comment.