Applying yield to task within the generator function awaits the task and returns underlying value in case of success
However the convinient option for typescript is to use yield* task.generator() as othervise one may have to deal with union types
In case of failure an error is thrown and may be caught by try-catch
If error is not caught the task is interrupted and returns 'just left error' immediately. In case of cancelation the task is interrupted and returns 'nothing' immediately
compound task execution is interrupted only at yield statements, so despite returning immediately any promise-based chains would continue running until the first yield
Note
due to type unpredictability you HAVE to use .generator() together with yield* to avoid type issues, despite the fact that task may be yielded directly
Create compound task from generator function
Applying yield to task within the generator function awaits the task and returns underlying value in case of success However the convinient option for typescript is to use
yield* task.generator()as othervise one may have to deal with union typesIn case of failure an error is thrown and may be caught by try-catch
If error is not caught the task is interrupted and returns 'just left error' immediately. In case of cancelation the task is interrupted and returns 'nothing' immediately