Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow binding patterns in rest binding elements #6275

Closed
DanielRosenwasser opened this issue Dec 28, 2015 · 3 comments
Closed

Allow binding patterns in rest binding elements #6275

DanielRosenwasser opened this issue Dec 28, 2015 · 3 comments
Labels
Bug A bug in TypeScript ES6 Relates to the ES6 Spec
Milestone

Comments

@DanielRosenwasser
Copy link
Member

See #2519 (comment).


New grammar rules:

    BindingRestElement[Yield]:
        ...BindingIdentifier[?Yield]
        ...BindingPattern[?Yield]

Relevant section:

https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns

Old work for disalllowing the construct was performed here: #2754.

@JsonFreeman
Copy link
Contributor

Remember to test this with ObjectBindingPattern as well, not just ArrayBindingPattern

@mhegazy mhegazy added this to the TypeScript 2.0 milestone Jan 7, 2016
@mhegazy mhegazy added ES6 Relates to the ES6 Spec and removed ES7 Relates to the ES7 Spec labels Aug 24, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, Future Sep 29, 2016
@mhegazy mhegazy assigned mhegazy and unassigned vladima Mar 24, 2017
@ajafff
Copy link
Contributor

ajafff commented Jul 27, 2018

@DanielRosenwasser there are actually two separate parts to this issue:

  • ParameterDeclaration and VariableDeclaration
    • only needs to remove the grammar check
    • downlevel emit already works as expected
  • allow BindingPattern for FunctionRestParameter
    • needs to remove the grammar check
    • currently there is no downlevel emit at all

ajafff added a commit to ajafff/TypeScript that referenced this issue Jul 27, 2018
ajafff added a commit to ajafff/TypeScript that referenced this issue Jul 27, 2018
ajafff added a commit to ajafff/TypeScript that referenced this issue Jul 27, 2018
also add downlevel emit for the destructured rest param

Part of microsoft#6275
@weswigham
Copy link
Member

Fixed by #26017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript ES6 Relates to the ES6 Spec
Projects
None yet
Development

No branches or pull requests

6 participants