Skip to main content
Module

x/valita/mod.ts>Type

A typesafe validation & parsing library for TypeScript.
Go to Latest
class Type
extends AbstractType<Output>
Abstract
import { Type } from "https://deno.land/x/valita@v0.3.6/mod.ts";

A base class for all concreate validators/parsers.

Type Parameters

optional
Output = unknown

Methods

nullable(): Type<null | Output>

Return new validator that accepts both the original type and null.

parse(v: unknown, options?: ParseOptions): Infer<this>

Parse a value. Throw a ValitaError on failure.

toTerminals(func: (t: TerminalType) => void): void
try(v: unknown, options?: ParseOptions): ValitaResult<Infer<this>>

Parse a value without throwing.