Error in Effect generator
Hi there,
I am using an effect generator and, at some point I need, depending on a test, to escape with an error.
To do that, I yield an error.
It works but the compiler does not know that the code after the yield will never be executed. So type narrowing does not work.
Instead of yielding an error, I tried to return it, to return a left, to return a failed effect. But the contents always go into the success channel and not into the error channel.
Adding an else or returning void adds and undefined in the success channel.
Here's what my code looks like:
Is there a trick?
Thanks in advance for your help.
I am using an effect generator and, at some point I need, depending on a test, to escape with an error.
To do that, I yield an error.
It works but the compiler does not know that the code after the yield will never be executed. So type narrowing does not work.
Instead of yielding an error, I tried to return it, to return a left, to return a failed effect. But the contents always go into the success channel and not into the error channel.
Adding an else or returning void adds and undefined in the success channel.
Here's what my code looks like:
Is there a trick?
Thanks in advance for your help.
