Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/zod/index.ts>z.ZodEnum

TypeScript-first schema validation with static type inference
Very Popular
Go to Latest
class z.ZodEnum
extends ZodType<T[number], ZodEnumDef<T>>
import { z } from "https://deno.land/x/zod@v3.21.3/index.ts";
const { ZodEnum } = z;

Type Parameters

T extends [string, ...string[]]

Properties

readonly
enum: Values<T>
readonly
Enum: Values<T>
readonly
options
readonly
Values: Values<T>

Methods

_parse(input: ParseInput): ParseReturnType<this["_output"]>
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract): ZodEnum<Writeable<ToExtract>>