Skip to content

InferEvaluatedBindings

InferEvaluatedBindings<TPattern> = { [K in ExtractNamedSchemas<TPattern> as K["name"]]: InferEvaluatedTypeInPattern<TPattern, K["schema"]> }

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

Infer evaluated bindings from a pattern: the object type eval receives (each property is delivered as a memoized thunk — see Thunked).

A FLAT per-binding map: binding-reference constraints resolve to the referenced operand’s constraint type; everything else is the element’s own type. Linked bindings are intentionally NOT correlated into a distributed union — the flat type is honest about what the parser guarantees per binding, and arktype’s match narrows per case for polymorphic evals (see the fixture’s add).

TPattern extends readonly PatternSchema[]

type Pattern = [
NamedSchema<ExprSchema<"number | string", "operand">, "left">,
ConstSchema<["+"]>,
NamedSchema<ExprSchema<"left", "rest">, "right">
];
type EvalBindings = InferEvaluatedBindings<Pattern>;
// { left: string | number; right: string | number }