Skip to main content
Module

x/valita/mod.ts>Optional

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

A validator/parser marked as "optional", signifying that their value can be missing from the parsed object.

As such optionals can only be used as property validators within object validators.

Constructors

new
Optional(type: AbstractType<Output>)

Type Parameters

optional
Output = unknown

Properties

readonly
name: string

Methods

func(v: unknown, mode: FuncMode): RawResult<Output | undefined>
toTerminals(func: (t: TerminalType) => void): void