Skip to main content
Module

x/valita/mod.ts>ObjectType

A typesafe validation & parsing library for TypeScript.
Go to Latest
class ObjectType
extends Type<ObjectOutput<Shape, Rest>>
import { ObjectType } from "https://deno.land/x/valita@v0.2.7/mod.ts";

Constructors

new
ObjectType(
shape: Shape,
restType: Rest,
checks?: { func: (v: unknown) => boolean; issue: IssueNode; }[],
)

Type Parameters

optional
Shape extends ObjectShape = ObjectShape
optional
Rest extends AbstractType | undefined = AbstractType | undefined

Properties

private
optional
_func: Func<unknown>
readonly
name: string

Methods

check(func: (v: ObjectOutput<Shape, Rest>) => boolean, error?: CustomError): ObjectType<Shape, Rest>
extend<S extends ObjectShape>(shape: S): ObjectType<Omit<Shape, keyof S> & S, Rest>
func(v: unknown, mode: FuncMode): RawResult<ObjectOutput<Shape, Rest>>
omit<K extends (keyof Shape)[]>(...keys: K): ObjectType<Omit<Shape, K[number]>, Rest>
partial(): ObjectType<[K in keyof Shape]: Optional<Infer<Shape[K]>>, Rest extends AbstractType<infer I> ? Optional<I> : undefined>
pick<K extends (keyof Shape)[]>(...keys: K): ObjectType<Pick<Shape, K[number]>, undefined>
rest<R extends Type>(restType: R): ObjectType<Shape, R>