Skip to content

Allow binding patterns in rest binding elements #6275

Closed

Description

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.

Activity

  1. JsonFreeman commented on Dec 28, 2015

    @JsonFreeman
    Contributor

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

  2. added
    ES6Relates to the ES6 Spec
    and removed
    ES7Relates to the ES7 Spec
    on Aug 24, 2016
  3. modified the milestones: TypeScript 2.1, on Sep 29, 2016
  4. ajafff commented on Jul 27, 2018

    @ajafff
    Contributor

    Daniel Rosenwasser (@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
  5. weswigham commented on Jan 14, 2019

    @weswigham
    Member

    Fixed by #26017

  6. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptES6Relates to the ES6 Spec

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions