Thankfully it shouldn't! There are still yields happening under the hood, but in Generator<Yield, Return, Next>, Next is the return value of individual yields which there can be many (source of the issue is they must be a product type A & B), while Return is the value returned when .next() returns done:true, and since there is only 1 value there we don't have to worry about the same typing complexities.
It's very easy to convert from one to the other. function*(thing) { const x = yield thing; return x}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmmm, I haven't wondered it! It surely restricts a little what you can express in code, but I not sure about what is lost.
Thankfully it shouldn't! There are still
yield
s happening under the hood, but inGenerator<Yield, Return, Next>
,Next
is the return value of individualyield
s which there can be many (source of the issue is they must be a product typeA & B
), whileReturn
is the value returned when .next() returnsdone:true
, and since there is only 1 value there we don't have to worry about the same typing complexities.It's very easy to convert from one to the other.
function*(thing) { const x = yield thing; return x}