The conditions a dot-path key accepts, from the declared type of the field it
names.
A nested field is resolved to its own definition and converted as that field,
so "shippedAt.at" on a nested date takes a Date just as a top level date
attribute does, and "items[0].sku" takes the element's own field. A path
that cannot be resolved — into a discriminated union variant, which one path
does not identify, or naming a field only one entity of a partition declares
— falls back to StoredFilterTypes, matching the expression builder,
which leaves such a value unvalidated and unconverted.
Distributed over Entities, which is what makes the first case reachable at
all: EntityAttributesOnly is built on Omit, which does not distribute, so
keyof over the whole union yields only the keys every partition entity
shares — and a path into an attribute declared by one entity resolved to
never and fell back to the stored form, while the builder resolved the
field exactly and validated in the declared form. The two surfaces then
accepted disjoint values.
Distribution alone is not enough, which is why the head segment is tested
separately. An entity that does not declare the attribute must contribute
never rather than StoredFilterTypes: both have no type at the path,
and only the head test separates "this entity has no such attribute" from
"the path exists here but names no single field".
The conditions a dot-path key accepts, from the declared type of the field it names.
A nested field is resolved to its own definition and converted as that field, so
"shippedAt.at"on a nested date takes aDatejust as a top level date attribute does, and"items[0].sku"takes the element's own field. A path that cannot be resolved — into a discriminated union variant, which one path does not identify, or naming a field only one entity of a partition declares — falls back to StoredFilterTypes, matching the expression builder, which leaves such a value unvalidated and unconverted.Distributed over
Entities, which is what makes the first case reachable at all:EntityAttributesOnlyis built onOmit, which does not distribute, sokeyofover the whole union yields only the keys every partition entity shares — and a path into an attribute declared by one entity resolved toneverand fell back to the stored form, while the builder resolved the field exactly and validated in the declared form. The two surfaces then accepted disjoint values.Distribution alone is not enough, which is why the head segment is tested separately. An entity that does not declare the attribute must contribute
neverrather than StoredFilterTypes: both have no type at the path, and only the head test separates "this entity has no such attribute" from "the path exists here but names no single field".