Skip to main content
Runs a contract in a single call — schema, RunFn, and options in one shot. Returns a ContractResult<T>. Implemented on top of defineContract; behavior is identical.

Signature

options

Same shape as ContractConfig<T> minus schema.

Example

When to use enforce vs defineContract

  • enforce — one-off, ad-hoc, experimental. Inline definition and execution.
  • defineContract — reusable, shared across endpoints, passed as a value.
See enforce vs defineContract for a full comparison.

See also

defineContract

Reusable contracts

Types

Full type reference