Skip to content

Make trailing commas on binding/rest not an error in .d.ts files #23070

Description

#22262 is pretty breaky, and the change is to be more spec compliant. To reduce how breaky the change is, we shouldn't report the error if it happens in a .d.ts file, as there will be no associated emit - this way older .d.ts files won't need to be updated just to remove trailing commas that we can actually handle just fine.

Activity

  1. unional commented on Apr 2, 2018

    @unional
    Contributor

    Can we emit a warning instead? Silent is not a good solution either.

  2. weswigham commented on Apr 2, 2018

    @weswigham
    MemberAuthor

    Declaration files will never be executed and are just metadata (for the compiler itself) - I think we can silently be more permissive in them.

  3. unional commented on Apr 2, 2018

    @unional
    Contributor

    But it would be nice to be able to detect them somehow so that typings authors can fix them easily.

    Another way is to rely on ts-lint auto-fix to remove all trailing commas. :)

  4. weswigham commented on Apr 2, 2018

    @weswigham
    MemberAuthor

    Those tools can still find and remove trailing rest/bind commas; we just don't need to report an error in a .d.ts - it's unhelpful and unneeded.

  5. ghost added
    FixedA PR has been merged for this issue
    on Apr 4, 2018
  6. ghost closed this as completedin #23139on Apr 4, 2018
  7. another-guy commented on May 31, 2018

    @another-guy

    #23139 results in breaking code builds with error TS1013: A rest parameter or binding pattern may not have a trailing comma.

    In my case, it happens in non *.d.ts code.

    I agree with Homa Wong (@unional), it should be a warning, unless bumping a major version is okay for such a small change.

  8. locked and limited conversation to collaborators on Jul 31, 2018
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 TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions