createIndexConstraintBuilder
createIndexConstraintBuilder<
TFields,TDoc>():ConstraintBuilder<TFields,TDoc>
Defined in: packages/core/src/access/createIndexConstraintBuilder.ts:39
Creates a positional constraint builder — the ix a rule receives inside
q.withIndex(name, (ix) => …).
Pure. Every method returns a NEW builder carrying the accumulated list; there
is no shared array and no caller-owned sink. That is what makes “only the value
the callback RETURNS counts” true rather than aspirational: a chain the rule
builds and discards leaves nothing behind, exactly like any other dead expression.
The earlier { into } sink made discarded chains apply anyway, which surprised in
the one direction that matters — a rule doing more than it appeared to.
The TYPE narrows per call — ConstraintBuilder’s three-interface state machine only exposes the methods still legal at each position. The RUNTIME object does not: each node carries all five methods, cast to the narrowing type on return. Type safety is enforced entirely at the call site, never here.
Type Parameters
Section titled “Type Parameters”TFields
Section titled “TFields”TFields extends readonly string[]
The index’s field tuple, in declaration order.
TDoc
The document shape constraint values are typed from.
Returns
Section titled “Returns”ConstraintBuilder<TFields, TDoc>
A builder positioned at field 0, with nothing accumulated.