Esbuild: Invalid output for parenthesized destructuring expression

Created on 3 Aug 2020  路  1Comment  路  Source: evanw/esbuild

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));

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elektronik2k5 picture elektronik2k5  路  3Comments

wcastand picture wcastand  路  4Comments

qnp picture qnp  路  4Comments

tonyhb picture tonyhb  路  3Comments

evanplaice picture evanplaice  路  3Comments