From d7e9bd0d9ca8ac0bfd5b4ab1cf95e9989b466d2c Mon Sep 17 00:00:00 2001 From: Loris Sigrist Date: Thu, 11 May 2023 13:13:29 +0200 Subject: [PATCH] Bugfix: Supply types --- .changeset/pretty-poets-carry.md | 5 +++++ src/lib/zocker.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/pretty-poets-carry.md diff --git a/.changeset/pretty-poets-carry.md b/.changeset/pretty-poets-carry.md new file mode 100644 index 0000000..3fa1bb4 --- /dev/null +++ b/.changeset/pretty-poets-carry.md @@ -0,0 +1,5 @@ +--- +"zocker": patch +--- + +fix: Fixed wrong type-definitions when using supply or override diff --git a/src/lib/zocker.ts b/src/lib/zocker.ts index af3ad47..1f312a0 100644 --- a/src/lib/zocker.ts +++ b/src/lib/zocker.ts @@ -96,9 +96,9 @@ class Zocker { * @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( - schema: Z, - generator: Generator | z.infer + supply( + schema: S, + generator: Generator | z.infer ) { const next = this.clone(); @@ -124,9 +124,9 @@ class Zocker { * @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( - schema: Z, - generator: Generator | z.infer + override( + schema: S, + generator: Generator | z.infer ) { const next = this.clone(); const generator_function =