From a6b1f0b1ba8878f8a40997a0708c7d341155e7de Mon Sep 17 00:00:00 2001 From: igalklebanov Date: Tue, 28 Feb 2023 00:19:36 +0200 Subject: [PATCH] fix syntax error following merge commit. --- deno/lib/README.md | 2 ++ deno/lib/types.ts | 14 +++++++++----- src/types.ts | 14 +++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/deno/lib/README.md b/deno/lib/README.md index a49080370..07baf5e02 100644 --- a/deno/lib/README.md +++ b/deno/lib/README.md @@ -24,6 +24,8 @@   •   npm   •   + deno +   •   Issues   •   @colinhacks diff --git a/deno/lib/types.ts b/deno/lib/types.ts index b1b0396f7..167572a8a 100644 --- a/deno/lib/types.ts +++ b/deno/lib/types.ts @@ -806,6 +806,10 @@ export class ZodString extends ZodType { addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "time", + message: check.message, + }); + status.dirty(); + } } else if (check.kind === "ip") { if (!isValidIP(input.data, check.version)) { ctx = this._getOrReturnCtx(input, ctx); @@ -853,7 +857,7 @@ export class ZodString extends ZodType { emoji(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); } - + uuid(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } @@ -861,11 +865,11 @@ export class ZodString extends ZodType { cuid(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } - + cuid2(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); } - + ip(options?: string | { version?: "v4" | "v6"; message?: string }) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); } @@ -1028,7 +1032,7 @@ export class ZodString extends ZodType { get isEmoji() { return !!this._def.checks.find((ch) => ch.kind === "emoji"); } - + get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } @@ -1036,7 +1040,7 @@ export class ZodString extends ZodType { get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } - + get isCUID2() { return !!this._def.checks.find((ch) => ch.kind === "cuid2"); } diff --git a/src/types.ts b/src/types.ts index dc18a8327..e58328ab7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -806,6 +806,10 @@ export class ZodString extends ZodType { addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "time", + message: check.message, + }); + status.dirty(); + } } else if (check.kind === "ip") { if (!isValidIP(input.data, check.version)) { ctx = this._getOrReturnCtx(input, ctx); @@ -853,7 +857,7 @@ export class ZodString extends ZodType { emoji(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); } - + uuid(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } @@ -861,11 +865,11 @@ export class ZodString extends ZodType { cuid(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } - + cuid2(message?: errorUtil.ErrMessage) { return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); } - + ip(options?: string | { version?: "v4" | "v6"; message?: string }) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); } @@ -1028,7 +1032,7 @@ export class ZodString extends ZodType { get isEmoji() { return !!this._def.checks.find((ch) => ch.kind === "emoji"); } - + get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } @@ -1036,7 +1040,7 @@ export class ZodString extends ZodType { get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } - + get isCUID2() { return !!this._def.checks.find((ch) => ch.kind === "cuid2"); }