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 import variable named of #1340

Closed
rpominov opened this issue Jan 30, 2016 · 6 comments
Closed

Can't import variable named of #1340

rpominov opened this issue Jan 30, 2016 · 6 comments

Comments

@rpominov
Copy link

Not sure if this by spec or a bug, but I couldn't find any mention of of being somehow special case in import.

4: import {of} from 'foo'
           ^^ Unexpected token of
@rpominov rpominov changed the title Can't import variable named of. Can't import variable named of Jan 30, 2016
@codemonkey800
Copy link

of is a reserved keyword for ES6. It's called a for-of loop It's used for iterating through the values in an iterable object:

const stuff = [1, 2, 3, 4, 5];
for (const value of stuff) {
  console.log(value);
}

You can read more about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of 😃

@michaelficarra
Copy link

@codemonkey800 No it's not.

@codemonkey800
Copy link

@michaelficarra Hmm, you're right. My mistake. Just went on MDN and confirmed it's not. Not sure what the issue is then.

@samwgoldman
Copy link
Member

Yup, looks like we're overstrict on this. Thanks for the bug report!

@samwgoldman
Copy link
Member

(By the way, I think the fantasyland project is great—is there an effort to integrate Flow? If so, keep me in the loop. I think it's a good motivating use case for us.)

@rpominov
Copy link
Author

@samwgoldman Unfortunately we accidently have made that integration harder by trying to fix name clashes issue (see 2. in fantasyland/fantasy-land#122 (comment))

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

No branches or pull requests

5 participants