Skip to main content
Go to Latest
class TypeCheck
import { TypeCheck } from "https://deno.land/x/openbox@1.1.5/deps.ts";

Constructors

new
TypeCheck(
schema: T,
references: Types.TSchema[],
checkFunc: CheckFunction,
code: string,
)

Type Parameters

T extends Types.TSchema

Properties

private
readonly
hasTransform: boolean

Methods

Check(value: unknown): value is Types.Static<T>

Returns true if the value matches the compiled type.

Code(): string

Returns the generated assertion code used to validate this type.

Decode(value: unknown): Types.StaticDecode<T>

Decodes a value or throws if error

Encode(value: unknown): Types.StaticEncode<T>

Encodes a value or throws if error

Errors(value: unknown): ValueErrorIterator

Returns an iterator for each error in this value.