The root entity being queried.
The inferred sort key condition type.
async function ordersFor(
customerId: string,
filter: SKScopedFilterParams<Customer, "Order">
) {
// Array<EntityAttributesInstance<Order>>
return await Customer.query(customerId, { skCondition: "Order", filter });
}
await ordersFor("123", { orderDate: { $gte: new Date("2026-01-01") } });
// A filter scoped to Order cannot name a ContactInformation attribute
await ordersFor("123", { email: "jane@example.com" }); // Compile error
Computes the filter type based on SK narrowing. When
skConditionnarrows to specific entities, only those entities' attributes are accepted in the filter. When SK doesn't narrow (no skCondition, suffixed string, etc.), falls back to the full TypedFilterParams. See ExtractEntityFromSK for which sort key conditions narrow.Use it to type a reusable filter for a query whose
skConditionnames an entity, passing the same sort key condition. A partition-wide TypedFilterParams is refused beside such anskCondition, because it also offers other entities' keys andtypevalues that cannot match the rows the sort key selects.