Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

z.ZodString

import { z } from "https://esm.sh/zod@3.25.76/index.d.cts"; 

const { ZodString } = z;
class ZodString extends ZodType<string, ZodStringDef, string> {
get isDatetime(): boolean;
get isDate(): boolean;
get isTime(): boolean;
get isDuration(): boolean;
get isEmail(): boolean;
get isURL(): boolean;
get isEmoji(): boolean;
get isUUID(): boolean;
get isNANOID(): boolean;
get isCUID(): boolean;
get isCUID2(): boolean;
get isULID(): boolean;
get isIP(): boolean;
get isCIDR(): boolean;
get isBase64(): boolean;
get isBase64url(): boolean;
get minLength(): number | null;
get maxLength(): number | null;
 
protected _regex(
regex: RegExp,
validation: StringValidation,
): ZodEffects<this, string, string>;
_addCheck(check: ZodStringCheck): ZodString;
_parse(input: ParseInput): ParseReturnType<string>;
base64(message?: errorUtil.ErrMessage): ZodString;
base64url(message?: errorUtil.ErrMessage): ZodString;
cidr(options?: string | {
version?: IpVersion;
message?: string | undefined;
}
): ZodString;
cuid2(message?: errorUtil.ErrMessage): ZodString;
date(message?: string): ZodString;
datetime(options?: string | {
message?: string | undefined;
precision?: number | null;
offset?: boolean;
local?: boolean;
}
): ZodString;
duration(message?: errorUtil.ErrMessage): ZodString;
email(message?: errorUtil.ErrMessage): ZodString;
emoji(message?: errorUtil.ErrMessage): ZodString;
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
includes(value: string, options?: {
message?: string;
position?: number;
}
): ZodString;
ip(options?: string | {
version?: IpVersion;
message?: string | undefined;
}
): ZodString;
jwt(options?: {
alg?: string;
message?: string | undefined;
}
): ZodString;
length(len: number, message?: errorUtil.ErrMessage): ZodString;
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
nanoid(message?: errorUtil.ErrMessage): ZodString;
nonempty(message?: errorUtil.ErrMessage): ZodString;
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
time(options?: string | {
message?: string | undefined;
precision?: number | null;
}
): ZodString;
toLowerCase(): ZodString;
toUpperCase(): ZodString;
trim(): ZodString;
 
static create: (params?: RawCreateParams & {
coerce?: true;
}
) => ZodString
;
}

§Extends

§
ZodType<string, ZodStringDef, string>
[src]

§Properties

§
isDatetime: boolean readonly
[src]
§
isDate: boolean readonly
[src]
§
isTime: boolean readonly
[src]
§
isDuration: boolean readonly
[src]
§
isEmail: boolean readonly
[src]
§
isURL: boolean readonly
[src]
§
isEmoji: boolean readonly
[src]
§
isUUID: boolean readonly
[src]
§
isNANOID: boolean readonly
[src]
§
isCUID: boolean readonly
[src]
§
isCUID2: boolean readonly
[src]
§
isULID: boolean readonly
[src]
§
isIP: boolean readonly
[src]
§
isCIDR: boolean readonly
[src]
§
isBase64: boolean readonly
[src]
§
isBase64url: boolean readonly
[src]
§
minLength: number | null readonly
[src]
§
maxLength: number | null readonly
[src]

§Methods

§
_regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string> protected
[src]
§
_addCheck(check: ZodStringCheck): ZodString
[src]
§
_parse(input: ParseInput): ParseReturnType<string>
[src]
§
cidr(options?: string | {
version?: IpVersion;
message?: string | undefined;
}
): ZodString
[src]
§
date(message?: string): ZodString
[src]
§
datetime(options?: string | {
message?: string | undefined;
precision?: number | null;
offset?: boolean;
local?: boolean;
}
): ZodString
[src]
§
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString
[src]
§
includes(value: string, options?: {
message?: string;
position?: number;
}
): ZodString
[src]
§
ip(options?: string | {
version?: IpVersion;
message?: string | undefined;
}
): ZodString
[src]
§
jwt(options?: {
alg?: string;
message?: string | undefined;
}
): ZodString
[src]
§
length(len: number, message?: errorUtil.ErrMessage): ZodString
[src]
§
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString
[src]
§
min(minLength: number, message?: errorUtil.ErrMessage): ZodString
[src]
§

Equivalent to .min(1)

§
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString
[src]
§
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString
[src]
§
time(options?: string | {
message?: string | undefined;
precision?: number | null;
}
): ZodString
[src]
§
toLowerCase(): ZodString
[src]
§
toUpperCase(): ZodString
[src]

§Static Properties

§
create: (params?: RawCreateParams & {
coerce?: true;
}
) => ZodString
[src]