Replies: 1 comment
-
I have analysed, I think it is more feasible for this to be automatic without the need to use instanceof, limiting simple types to Atomico validation is really simple /~https://github.com/atomicojs/atomico/blob/master/src/element/set-prototype.js#L146-L153. const filterValue = (type, value) =>
type == Any
? { value }
: type != String && value === ""
? { value: null }
: {}.toString.call(value) == `[object ${type.name}]`
? { value, error: type == Number && Number.isNaN(value) }
: { value, error: true }; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The goal of this feature is to improve the way of declaring types in Atomico, allowing input values not only to depend on the type, but also on the type of the instance, example:
Now Atomico is strict when defining types
but with this new property we can check not by strict type but by instance of the constructor
This will allow your web component to work internally with custom Constructors.
Beta Was this translation helpful? Give feedback.
All reactions