Open thecotne opened 4 years ago
it would be cool to have first class support for this kind of things
for example with syntax like this
// @hegel-assert $PropertyType<{ type: 'cotne' }, 'type'> @is 'cotne'
// @hegel-assert $PropertyType<{ type: 'cotne' }, 'type'> @is-not 'name'
// @hegel-assert $PropertyType<{ type: 'cotne' }, 'type'> @is-sub-type-of string
// @hegel-assert $PropertyType<{ type: 'cotne' }, 'type'> @is-sub-type-of 'cotne' | 'name'
this will allow custom exhaustive checking (and maybe even more)
Good point. I need to think about it, especially about the syntax. Thank you for your contribution ^_^.
i am doing something like this in flow
try
i am checking that object union has all actions from
NotificationAction
and nothing extrain flow this is very hacky but in hegel i think it's impossible to achieve same result because i can't
declare var
and i can't use type casting (type casting can be replaced with variable declaration but then i have reference of undefined variable in code)