fix: Handle non-awaited async generator#4417
Merged
evanw merged 2 commits intoevanw:mainfrom Apr 1, 2026
Merged
Conversation
Revert "fix: Call generator functions synchronously if necessary" This reverts commit b90ba12.
b90ba12 to
3afa519
Compare
evanw
approved these changes
Apr 1, 2026
Owner
evanw
left a comment
There was a problem hiding this comment.
Thanks for the PR. Really appreciate you adding all of these tests. I see how the queue works and I think this approach makes sense, as TypeScript's __asyncGenerator helper function also uses a queue.
I don't have this loaded in my head right now but I think moving forward is reasonable given the test coverage, the simplicity of the change, and the similarity to TypeScript's approach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a queue to
__asyncGeneratorto preserve the order in which.nextand other generator methods are called even when they are not awaited.Fixes #4401.