Open bmomberger-bitovi opened 4 years ago
Type checking happens when the property is set, so errors are thrown if you set the prop
instead of propValue
.
I don't see the two being mutually exclusive. We had the same discussion about type
and default
(when it was called value
) ages ago, and I think that the principles still apply here.
So you think we should type check twice? Type check when the value is set and type check when resolve
is called?
Yes, either twice, or only when resolve
is called when a value
behavior exists.
Alternatively we could pass type
as a function parameter to the value
behavior. But my gut instinct is that the flexibility to call the type checker/converter whenever isn't more beneficial than the simplicity of leaving it as declarative.
https://codepen.io/bmomberger-bitovi/pen/OJJGZZq
This should at very least warn in dev mode. Ideally it should have the same type checking as when the property is set externally.