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

Fix "TypeError: comments is not iterable" #8701

merged 1 commit into from Nov 9, 2018

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

@babel-bot babel-bot commented Sep 13, 2018

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

@xtuc
Copy link
Member

@xtuc xtuc commented Sep 13, 2018

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

@danez
Copy link
Member

@danez 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
4 checks passed
4 checks passed
@babel-bot
babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
@codecov
codecov/project 80.62% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@danez
Copy link
Member

@danez danez commented Nov 9, 2018

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants