Skip to main content
Module

x/value_schema/src/schemaClasses/EnumerationSchema.ts

simple, easy-to-use, and declarative input validator; supports Node.js, TypeScript, Deno, and Bun
Go to Latest
File
import * as ifEmptyString from "../appliers/ifEmptyString";import * as ifNull from "../appliers/ifNull";import * as ifUndefined from "../appliers/ifUndefined";import * as only from "../appliers/only";
import {BaseSchema} from "./BaseSchema";
export type OptionsForEnumeration<E> = ifUndefined.Options<E> & ifEmptyString.Options<E> & ifNull.Options<E> & Required<only.Options<E>>;
export class EnumerationSchema<E, Tx = never> extends BaseSchema<E | Tx>{ constructor(options: OptionsForEnumeration<E>) { super(options, [ ifUndefined.applyTo, ifEmptyString.applyTo, ifNull.applyTo, only.applyTo, ]); }}