Skip to content

CompiledRule

CompiledRule<TGrammar, TInput, TSchema, $> = string extends TInput ? Type<(In) => Out<unknown>> : EvaluateResult<TGrammar, TInput, TSchema, $> extends infer R ? [R] extends [boolean] ? Type<InferValues<TSchema, $>> : Type<(In) => Out<R>> : never

Defined in: src/createParser.ts:115

The arktype Type produced by parser.compile():

  • a rule with boolean output is a PREDICATE — the Type validates the values object and rejects when the rule evaluates false (values in, values out)
  • any other rule is a MORPH — values in, evaluated result out
  • dynamic (non-literal) input: morph to unknown; the runtime decides

TGrammar extends Grammar

TInput extends string

TSchema extends SchemaShape

$

$ extends object = { }