diff --git a/deno/lib/__tests__/string.test.ts b/deno/lib/__tests__/string.test.ts index 0288a23f9..bb967bafc 100644 --- a/deno/lib/__tests__/string.test.ts +++ b/deno/lib/__tests__/string.test.ts @@ -8,7 +8,7 @@ import * as z from "../index.ts"; const minFive = z.string().min(5, "min5"); const maxFive = z.string().max(5, "max5"); const justFive = z.string().length(5); -const nonempty = z.string().min(1, "nonempty"); +const nonempty = z.string().nonempty("nonempty"); const includes = z.string().includes("includes"); const includesFromIndex2 = z.string().includes("includes", { position: 2 }); const startsWith = z.string().startsWith("startsWith"); diff --git a/deno/lib/types.ts b/deno/lib/types.ts index 96613e53a..3580f39a1 100644 --- a/deno/lib/types.ts +++ b/deno/lib/types.ts @@ -1133,7 +1133,10 @@ export class ZodString extends ZodType { } base64url(message?: errorUtil.ErrMessage) { // base64url encoding is a modification of base64 that can safely be used in URLs and filenames - return this._addCheck({ kind: "base64url", ...errorUtil.errToObj(message) }); + return this._addCheck({ + kind: "base64url", + ...errorUtil.errToObj(message), + }); } jwt(options?: { alg?: string; message?: string }) { @@ -1267,8 +1270,7 @@ export class ZodString extends ZodType { } /** - * @deprecated Use z.string().min(1) instead. - * @see {@link ZodString.min} + * Equivalent to `.min(1)` */ nonempty(message?: errorUtil.ErrMessage) { return this.min(1, errorUtil.errToObj(message)); diff --git a/src/__tests__/string.test.ts b/src/__tests__/string.test.ts index c211c492a..bc603a933 100644 --- a/src/__tests__/string.test.ts +++ b/src/__tests__/string.test.ts @@ -7,7 +7,7 @@ import * as z from "../index"; const minFive = z.string().min(5, "min5"); const maxFive = z.string().max(5, "max5"); const justFive = z.string().length(5); -const nonempty = z.string().min(1, "nonempty"); +const nonempty = z.string().nonempty("nonempty"); const includes = z.string().includes("includes"); const includesFromIndex2 = z.string().includes("includes", { position: 2 }); const startsWith = z.string().startsWith("startsWith"); diff --git a/src/types.ts b/src/types.ts index 850106dd7..b5e76976a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1133,7 +1133,10 @@ export class ZodString extends ZodType { } base64url(message?: errorUtil.ErrMessage) { // base64url encoding is a modification of base64 that can safely be used in URLs and filenames - return this._addCheck({ kind: "base64url", ...errorUtil.errToObj(message) }); + return this._addCheck({ + kind: "base64url", + ...errorUtil.errToObj(message), + }); } jwt(options?: { alg?: string; message?: string }) { @@ -1267,8 +1270,7 @@ export class ZodString extends ZodType { } /** - * @deprecated Use z.string().min(1) instead. - * @see {@link ZodString.min} + * Equivalent to `.min(1)` */ nonempty(message?: errorUtil.ErrMessage) { return this.min(1, errorUtil.errToObj(message));