The error surface presented when a target guard is written on a foreign
key that backs a BelongsTo relationship.
Never written by hand: it is the type a target takes on such a key, so
the compile error on the guard quotes its message and names the
relationship to use.
The referenced row is guarded under the relationship key instead, so that
one parent row is never reachable by two keys.
Example
// Order declares customerId: ForeignKey<Customer> and a BelongsTo customer awaitOrder.update( "order-1", { total:90 }, // Compile error naming this surface, with relationship: "customer" { condition: { customerId: { target: { status:"active" } } } } );
// Guard the Customer under the relationship instead awaitOrder.update( "order-1", { total:90 }, { condition: { customer: { status:"active" } } } );
The error surface presented when a
targetguard is written on a foreign key that backs a BelongsTo relationship.Never written by hand: it is the type a
targettakes on such a key, so the compile error on the guard quotes its message and names the relationship to use.The referenced row is guarded under the relationship key instead, so that one parent row is never reachable by two keys.
Example