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

Follow the Object Rest Destructuring specification #68

Closed
diegohaz opened this issue Jan 17, 2017 · 3 comments
Closed

Follow the Object Rest Destructuring specification #68

diegohaz opened this issue Jan 17, 2017 · 3 comments

Comments

@diegohaz
Copy link
Owner

https://github.com/sebmarkbage/ecmascript-rest-spread/blob/master/Rest.md

Currently, we are breaking this rule on some component props destructuring:

let { ...x, y, z } = obj; // syntax error

The components are:

The solution is probably as simple as changing this:

const Feature = ({ icon, title, link, children, ...props, soon }) => {

to this:

const Feature = ({ icon, title, link, children, ...props }) => {
  const { soon } = props

I'll leave this issue here for a while for the case of someone wants to contribute.

@antoinerey
Copy link

What does produce ?

const Feature = ({ icon, title, link, children, ...props, soon }) => {

Does it :

  1. make soon available as variable
  2. but, does not extract soon from props (so props.soon exists) ?

@diegohaz
Copy link
Owner Author

make soon available as variable
but, does not extract soon from props (so props.soon exists) ?

Exactly. This is currently possible with Babel, but isn't in the spec, so might break in the future.

@diegohaz
Copy link
Owner Author

Maybe just changing references from too to props.too should be more elegant. I don't know, only IconButton has many variables after props.

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

2 participants