Skip to content

ConstraintSpec

ConstraintSpec = string | OverlapsRef

Defined in: src/schema/index.ts:110

A constraint on an expression slot:

  • a string naming an EARLIER binding in the same pattern — “assignable to whatever that operand parsed as” (e.g. rest(“left”))
  • any other string — an arktype definition compiled in the parser’s scope (e.g. operand(“number”), operand(“string | number”), operand(“string.email”))
  • a def EMBEDDING earlier binding names (e.g. rest(“left | null”)) — resolved per-parse in a scope extended with the parsed operand types
  • overlapping(“left”) — symmetric: types must overlap, not nest

createParser decides string interpretation: binding names shadow nothing because a binding name that is also a resolvable def is a construction error.