Testing a type in pipe
Congratulations on the 2.0 release, it's working great! 😀 Is it possible/best practice to run a type inside pipe? I'm having this test condition:
I'm not sure of the best way to handle this scenario with morphs? I see there's a second parameter for
pipe.try
, can it be used to simplify?4 Replies
Here's the simple solution:
But can it be improved with morphs?
No but it could be simplified with pattern matching which we're about to release 😊
I mean under the hood, pattern matching is just an ordered union with morphs... but without the new syntax, creating an ordered union in 2.0.4 would probably be a bit confusing haha
(you'd have to use the underlying
@ark/schema
representation)At that point you will be able to do it like this:

Ok, looks very nice!