Skip to content

ConstraintsCallback

ConstraintsCallback<TData, TUser, TOrg, TQ> = (props) => boolean | AccessConditionResult

Defined in: packages/core/src/access/types.ts:169

A rule’s constraint-recording callback.

ONE signature returning boolean | ConstraintResult, never a union of two function types: verified against tsc that a union of differently-shaped callbacks breaks contextual typing of the destructured props — every parameter infers any instead of TypeScript picking a member. boolean is primitive and ConstraintResult is nominal, so discriminating the RESULT at runtime (typeof result === "boolean") stays unambiguous.

TData = unknown

Document type constraints are typed against.

TUser = Record<string, unknown>

User document shape.

TOrg = Record<string, unknown>

Organization document shape; never if not configured.

TQ = AccessPredicateBuilder<TData>

The builder for this action.

ConstraintsCallbackProps<TData, TUser, TOrg, TQ>

boolean | AccessConditionResult