Safety of Throwing Yieldable Errors
The new yieldable errors are a great addition! Is it safe to
Basically I have a couple of places where I want to yield an error if some condition fails, like this:
However since TS isn't aware that Effect will bail early on error,
Then the type is narrowed appropriately.
Running the above two snippets with an
throw yield one of these things?Basically I have a couple of places where I want to yield an error if some condition fails, like this:
However since TS isn't aware that Effect will bail early on error,
foo is still string | undefined after the if-condition. If I instead do:Then the type is narrowed appropriately.
Running the above two snippets with an
undefined input gives the same failure, but I'm wondering if there are any subtle differences in runtime behaviour for more complex programs?