Documentation
Reference

Reference

Functions

wrap

function wrap<TSchema extends Schema>(
  schema: TSchema,
): TypeSchema<Infer<TSchema>, InferIn<TSchema>> { ... }

Returns the wrapped schema with access to all its operations.

validate

function validate<TSchema extends Schema>(
  schema: TSchema,
  data: unknown,
): Promise<ValidationResult<Infer<TSchema>>> { ... }

Returns the validated data or a list of ValidationIssues.

assert

function assert<TSchema extends Schema>(
  schema: TSchema,
  data: unknown,
): Promise<Infer<TSchema>> { ... }

Returns the validated data or throws an AggregateError.

Types

Schema

Generic interface for schemas. An union of the schema types of all supported libraries.

TypeSchema

Interface for a wrapped schema, exposing all its operations.

Infer

Extracts the output type of a schema.

InferIn

Extracts the input type of a schema.

ValidationIssue

Generic interface for validation issues. Includes a message and an optional path.