Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing parentheses on async inside for..of #10781

Merged
merged 9 commits into from May 6, 2021

Conversation

fisker
Copy link
Sponsor Member

@fisker fisker commented Apr 29, 2021

Description

Fixes #10777

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker fisker marked this pull request as ready for review April 29, 2021 09:58
Copy link
Member

@thorn0 thorn0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, the parens aren't needed in for await (async of []);, but Babel can't parse it without them.

@sosukesuzuki
Copy link
Member

sosukesuzuki commented Apr 29, 2021

@thorn0 Has it been reported to babel/babel or fixed already in main?

@thorn0
Copy link
Member

thorn0 commented Apr 29, 2021

@sosukesuzuki I only left a comment in babel/babel#13208, but I didn't report this issue properly. There are also issues with let (#10777 (comment)). And there might be more. A good read through the spec is needed.

@sosukesuzuki
Copy link
Member

@thorn0 Thank you. I'll investigate specs and report to babel/babel and fix, okay?

@thorn0
Copy link
Member

thorn0 commented Apr 29, 2021

Sounds good 👍 Probably these changes in the spec are recent.

@thorn0
Copy link
Member

thorn0 commented Apr 29, 2021

BTW, here is valid TypeScript that compiles to invalid JS by both the TypeScript compiler and Babel (probably fixed by babel/babel#13208): for ((async as any) of []);

@thorn0 thorn0 merged commit 877e64c into prettier:main May 6, 2021
@fisker fisker deleted the for-of-async branch May 7, 2021 01:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing parentheses for ((async) of []);
3 participants