jashkenas/coffeescript

Support export destructured assignment

Opened this issue · 2 comments

Choose one: is this a bug report or feature request?
Feature request

@GeoffreyBooth I came across an unsupported export syntax that appears to be standard

Input Code

export {foo, bar} = item

Expected Behavior

Should transpile to export var {foo, bar} = item

Current Behavior

Doesn't compile

Possible Solution

Guessing it won't be bad to add this as a supported grammar rule

Context

Not blocking anything, just came across it while working on AST stuff

Environment

  • CoffeeScript version:
  • Node.js version:

Good catch. I guess this can be the workaround for now:

{foo, bar} = item
export {foo, bar}

Another example of this:

export [signal, setSignal] = createSignal()

should ideally compile to

export const [signal, setSignal] = createSignal()

Same workaround works, of course:

[signal, setSignal] = createSignal()
export {signal, SetSignal}

I'll probably look into fixing this, after I finally get to revising #5398.