Skip to content

Commit

Permalink
Remove logging in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Mar 6, 2023
1 parent 006e652 commit bdcff0f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
2 changes: 0 additions & 2 deletions deno/lib/__tests__/catch.test.ts
Expand Up @@ -222,8 +222,6 @@ test("catch error", () => {

test("ctx.input", () => {
const schema = z.string().catch((ctx) => {
console.log(ctx.input);
console.log(ctx.error);
return String(ctx.input);
});

Expand Down
10 changes: 2 additions & 8 deletions deno/lib/types.ts
Expand Up @@ -4305,10 +4305,7 @@ export class ZodEffects<
path: ctx.path,
parent: ctx,
});
// if (base.status === "aborted") return INVALID;
// if (base.status === "dirty") {
// return { status: "dirty", value: base.value };
// }

if (!isValid(base)) return base;

const result = effect.transform(base.value, checkCtx);
Expand All @@ -4324,10 +4321,7 @@ export class ZodEffects<
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
.then((base) => {
if (!isValid(base)) return base;
// if (base.status === "aborted") return INVALID;
// if (base.status === "dirty") {
// return { status: "dirty", value: base.value };
// }

return Promise.resolve(effect.transform(base.value, checkCtx)).then(
(result) => ({ status: status.value, value: result })
);
Expand Down
8 changes: 7 additions & 1 deletion playground.ts
@@ -1,2 +1,8 @@
import { z } from "./src";
z;

function foo<Schema extends z.AnyZodObject>(schema: Schema) {
return z.object({ bar: schema }).transform((x) => x.bar);
// ^^^
// Property 'bar' does not exist on type
// '{ [k in keyof baseObjectOutputType<{ bar: Schema; }>]: baseObjectOutputType<{ bar: Schema; }>[k]; }'.
}
2 changes: 0 additions & 2 deletions src/__tests__/catch.test.ts
Expand Up @@ -221,8 +221,6 @@ test("catch error", () => {

test("ctx.input", () => {
const schema = z.string().catch((ctx) => {
console.log(ctx.input);
console.log(ctx.error);
return String(ctx.input);
});

Expand Down
10 changes: 2 additions & 8 deletions src/types.ts
Expand Up @@ -4305,10 +4305,7 @@ export class ZodEffects<
path: ctx.path,
parent: ctx,
});
// if (base.status === "aborted") return INVALID;
// if (base.status === "dirty") {
// return { status: "dirty", value: base.value };
// }

if (!isValid(base)) return base;

const result = effect.transform(base.value, checkCtx);
Expand All @@ -4324,10 +4321,7 @@ export class ZodEffects<
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
.then((base) => {
if (!isValid(base)) return base;
// if (base.status === "aborted") return INVALID;
// if (base.status === "dirty") {
// return { status: "dirty", value: base.value };
// }

return Promise.resolve(effect.transform(base.value, checkCtx)).then(
(result) => ({ status: status.value, value: result })
);
Expand Down

0 comments on commit bdcff0f

Please sign in to comment.