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

Invalid output for parenthesized destructuring expression #313

Closed
aleclarson opened this issue Aug 3, 2020 · 1 comment
Closed

Invalid output for parenthesized destructuring expression #313

aleclarson opened this issue Aug 3, 2020 · 1 comment

Comments

@aleclarson
Copy link

The outermost parentheses are moved from
({ ... } = Object.assign(...))
to
({ ... }) = Object.assign(...)
which creates invalid Javascript 😱

Input:

export const assign = (globals: AnimatedGlobals): AnimatedGlobals =>
  ({
    to,
    now,
    frameLoop,
    colorNames,
    skipAnimation,
    createStringInterpolator,
    requestAnimationFrame,
    batchedUpdates,
    willAdvance,
  } = Object.assign(
    {
      to,
      now,
      frameLoop,
      colorNames,
      skipAnimation,
      createStringInterpolator,
      requestAnimationFrame,
      batchedUpdates,
      willAdvance,
    },
    pluckDefined(globals)
  ))

Output:

export const assign = (globals) => ({
  to,
  now,
  frameLoop,
  colorNames,
  skipAnimation,
  createStringInterpolator,
  requestAnimationFrame,
  batchedUpdates,
  willAdvance
}) = Object.assign({
  to,
  now,
  frameLoop,
  colorNames,
  skipAnimation,
  createStringInterpolator,
  requestAnimationFrame,
  batchedUpdates,
  willAdvance
}, pluckDefined(globals));
@evanw evanw closed this as completed in 80273dc Aug 3, 2020
@evanw
Copy link
Owner

evanw commented Aug 3, 2020

Thanks for the report. Really sorry about that. This should be fixed in version 0.6.16.

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

No branches or pull requests

2 participants