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

Can't yield an array #16294

Closed
edemaine opened this issue May 16, 2024 · 1 comment
Closed

Can't yield an array #16294

edemaine opened this issue May 16, 2024 · 1 comment

Comments

@edemaine
Copy link

Prettier 3.2.5
Playground link

--parser babel

Input:

yield [a, b]

Output:

yield[(a, b)];

Expected output:

yield [a, b]

Why?
Yielding an array is valid.

Workaround for now:

yield ([a, b])
@edemaine
Copy link
Author

Ah, it seems that this works inside a function*. So I guess this is just an issue of context. Annoying for toy examples though (as on a list of examples like this). Feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant