Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Promises returned from generators are not resolved automatically #64
In Q, if an async generator returns a promise, that promise is resolved and the resolved value is passed on. In Bluebird, the promise itself is passed along as the next value:
The workaround in Bluebird is to yield on the promise before returning it:
But that seems like an unnecessary extra step that could be avoided, and I think it goes against expectations coming from Promise.try(). Is this behavior intentional?
To be fair, in C# you would write
The Bluebird behavior seems nice (and correct) but I see your point - this is inconsistent with the way promises unwrap. Definitely something we need to think about.