Skip to main content
@usenarrator/plugin-arktype The ArkType plugin reads type(...) definitions as the shapes they describe, the same way the zod and Valibot plugins do. It understands ArkType’s string syntax, so "1 <= string <= 280" reads as “text (at least 1 long, at most 280 long)” and "'admin' | 'member'" reads as one of two values. Calling a schema reads as validating data with it.
The plugin declares library: { name: "arktype", versions: ">=2 <3" }. It only reads type and scope when they are imported from arktype, so a local function named type is left alone.

Examples

Definitions
English
Validation
English

What it covers

  • Object definitions with optional keys, nested objects and arrays.
  • The string syntax: keywords such as string.email, string.uuid and number.integer, bounds, unions, arrays, defaults, divisors and parsing keywords like string.numeric.parse.
  • Chained methods and statics such as .array(), .or(), .and(), .pipe(), .narrow(), .optional(), .default() and type.enumerated.
  • Validation: calling a schema, type.errors, assert and allows.
  • scope(...) with its named schemas.

Translating

The English phrasebook is exported as en and typed as ArkTypePhrases.