speedskater/babel-plugin-rewire

Breaks compilation when destructuring when assigning to an existing variable

Opened this issue · 2 comments

let a
[a] = [1]

Valid ES6, but blows up with rewire:

TypeError: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "CallExpression"

Same problem with objects:

let a
({a} = { a: 'b'})

Works with creating a new variable:

let [a] = [1]

i'm still having this issue

kjs3 commented

Just hit this. Here's my lame little hack in the meantime.

let a,b

const { a: x, b: y } = myFunc()
a = x
b = y

😞