Closed ceres-c closed 2 years ago
{a, b, ...rest} = {a: 1, b: 2, c: 30, d: 40}
is not legal JavaScript (even with the missing comma added). You need to wrap it in parentheses for it to be parsed as an assignment expression, as in ({a, b, ...rest} = {a: 1, b: 2, c: 30, d: 40})
. And then it will indeed be parsed (at least with the latest version of shift-parser).
Now I feel terribly stupid, sorry. I was experimenting with assignments to both arrays and objects and I forgot the fundamental parentheses while quickly modifying my test code. :( Node console accepting the expression without the parentheses didn't help me either
Sorry again and thanks for the great libs you people built
No worries. The repl thing does tend to trip people up.
Statements such as
{a, b, ...rest} = {a: 1, b: 2 c: 30, d: 40}
are not supported and shift-parser throws anUnexpected token "..."
Error.If I get this right, it should be considered part of the language now, but correct me if I'm wrong and this was left out as a deliberate choice