Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

support trailing commas for object rest #47

Open
graingert opened this issue Jun 2, 2017 · 3 comments
Open

support trailing commas for object rest #47

graingert opened this issue Jun 2, 2017 · 3 comments

Comments

@graingert
Copy link

graingert commented Jun 2, 2017

# support trailing commas when the last property is a rest.
const {
    a,
    ...b,
} = foo;

# maybe worth adding for arrays too?
const [
    c,
    ...d,
] = bar;
@loganfsmyth
Copy link

This is already allowed in the spec. Trailing commas are only disallowed for object rest, not object spread, which is consistent with the behavior for arrays.

@graingert
Copy link
Author

@loganfsmyth updated

@loganfsmyth
Copy link

The trailing comma implies that there could be more stuff after it, but since it is a rest, there cannot be, which is why the comma isn't allowed for arrays either.

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

No branches or pull requests

2 participants