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 "TypeError: comments is not iterable" #8701

Merged
merged 1 commit into from Nov 9, 2018
Merged

Conversation

AlicanC
Copy link
Contributor

@AlicanC AlicanC commented Sep 13, 2018

Q                       A
Fixed Issues? Fixes #8700
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? No
License MIT

In some cases, comments is null and for (const comment of comments) throws a TypeError. I have simply wrapped fors with a check.

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9114/

@xtuc
Copy link
Member

xtuc commented Sep 13, 2018

Could you please add a test case that shows the bug?

@xtuc xtuc added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Sep 13, 2018
@danez
Copy link
Member

danez commented Nov 6, 2018

I'm on the fence for this. I see that this could fail if comments is not there, which should never happen in the first place, as the parser always sets it to an array. The only option I see is using the Constructor for File in babel-types which probably sets it to null, but haven't tested. On the other hand I wonder why the transformations run at all if your run babel on png files. I would guess that the js parser should immediately throw as it is not javascript.

But I don't really know how metro and react native works and how it treats imported images.

@danez danez merged commit bf8c478 into babel:master Nov 9, 2018
@danez
Copy link
Member

danez commented Nov 9, 2018

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: comments is not iterable
4 participants