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

x/typeguardkit/mod.ts>Validator

A TypeScript module to help construct type assertion functions and type guards.
Latest
interface Validator
Re-export
import { type Validator } from "https://deno.land/x/typeguardkit@0.33.0/mod.ts";

A Validator<Type> has a validate method, which should check value meets any runtime-only constraints of Type, and return any issues. This should not include constraints of any Validators for properties or elements of Type.

Any Asserter<Type> class that allows runtime-only constraints should also implement Validator<Type>.

validate can then be used to validate user input client side, where it should already be known that value meets the compile-time constraints of Type.

Methods

validate(value: Type): string[]