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

Computed Object property generates broken syntax #92

Closed
miljan-aleksic opened this issue Jan 8, 2018 · 2 comments
Closed

Computed Object property generates broken syntax #92

miljan-aleksic opened this issue Jan 8, 2018 · 2 comments

Comments

@miljan-aleksic
Copy link

miljan-aleksic commented Jan 8, 2018

Hi and thanks for such great products @Rich-Harris,

there is a small issue depending on how the computed properties are ordered:

// this is well transpiled
const ref = {
  'foo': bar,
  [`foo-${bar}`]: fooBar
}

// becomes
var ref = {
  'foo': bar
};
ref[("foo-" + bar)] = fooBar
// this is is not
const ref = {
  [`foo-${bar}`]: fooBar,
  'foo': bar
}

// becomes
var ref = {};
ref[("foo-" + bar)] = fooBar;
ref.'foo' = bar // where this is unvalid JS syntax

As temporal workaround is to keep the computed properties always last, but it would be nice if this could be solved. I don't have much experience with this project, sorry for not having any PR instead.

@adrianheine
Copy link
Member

#91 might be a fix for this.

@adrianheine
Copy link
Member

Fixed with #91.

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