Open cromoteca opened 1 month ago
Seems like casting would not be compatible with nullable fields. Let's address after introducing Object Models, which support optionality on the model type level.
My idea was to cast to the entity type, so nullable fields should be compatible. But I cannot get the information from the model, as it seems that only the parent knows about optional values.
Describe the bug
I have an entity with a property of type
Player[]
(not nullable). I noticed that, when usinguseFormPart
,value
andsetValue
usePlayer[] | undefined
as type. This comes fromBinderNode
's type definitions:get value(): Value<M> | undefined
andset value(value: Value<M> | undefined)
.Expected-behavior
value
andsetValue
should be cast to the correct type, even ifBinderNode
returns different type for internal reasons.Reproduction
Define an entity like above and call
useFormPart
on it.System Info
Hilla 24.5.0.alpha1