Extracts entity names from a typed sort key condition for return type narrowing.
Narrows when:
SK is an exact entity name: "Order" → "Order"
SK is { $beginsWith: "Order" } → "Order"
SK is { $beginsWith: "Inv" } → "Invoice" | "Inventory" (prefix matches multiple)
SK is { $beginsWith: "PaymentMethod" } → "PaymentMethod" | "PaymentMethodProvider"
(when one entity name is a prefix of another)
Does not narrow when:
SK is a prefixed string like "Order#123" (can't parse the delimiter at type level)
SK is { $beginsWith: "Order#" } (a prefix past the entity name's boundary)
SK is a comparison or a $between range
The table's delimiter is configurable and is not visible to the types, so
they cannot tell where an entity name ends inside a longer value. Narrowing
on a name or a prefix of one assumes that no entity's sort key starts with
another entity's name followed by the delimiter. That always holds with the
default # delimiter, and with any delimiter whose first character cannot
appear in a class name.
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#" }(a prefix past the entity name's boundary)$betweenrangeThe table's delimiter is configurable and is not visible to the types, so they cannot tell where an entity name ends inside a longer value. Narrowing on a name or a prefix of one assumes that no entity's sort key starts with another entity's name followed by the delimiter. That always holds with the default
#delimiter, and with any delimiter whose first character cannot appear in a class name.