Extracts entity names from a typed sort key condition for return type narrowing.
Narrows when:
"Order"
{ $beginsWith: "Order" }
{ $beginsWith: "Inv" }
"Invoice" | "Inventory"
{ $beginsWith: "PaymentMethod" }
"PaymentMethod" | "PaymentMethodProvider"
Does not narrow when:
"Order#123"
{ $beginsWith: "Order#..." }
The entity type being queried.
The inferred sort key condition literal type.
Extracts entity names from a typed sort key condition for return type narrowing.
Narrows when:
"Order"→"Order"{ $beginsWith: "Order" }→"Order"{ $beginsWith: "Inv" }→"Invoice" | "Inventory"(prefix matches multiple){ $beginsWith: "PaymentMethod" }→"PaymentMethod" | "PaymentMethodProvider"(when one entity name is a prefix of another)Does not narrow when:
"Order#123"(can't parse the delimiter at type level){ $beginsWith: "Order#..." }(specific prefix past entity name boundary)