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

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

Closed
weswigham opened this issue Apr 2, 2018 · 5 comments
Closed

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

weswigham opened this issue Apr 2, 2018 · 5 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@weswigham
Copy link
Member

weswigham commented Apr 2, 2018

#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.

@unional
Copy link
Contributor

unional commented Apr 2, 2018

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

@weswigham
Copy link
Member Author

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

@unional
Copy link
Contributor

unional commented Apr 2, 2018

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. :)

@mhegazy mhegazy assigned ghost Apr 2, 2018
@mhegazy mhegazy added this to the TypeScript 2.9 milestone Apr 2, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 2, 2018
@weswigham
Copy link
Member Author

weswigham commented Apr 2, 2018

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.

@ghost ghost added the Fixed A PR has been merged for this issue label Apr 4, 2018
@ghost ghost closed this as completed in #23139 Apr 4, 2018
@another-guy
Copy link

#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 @unional, it should be a warning, unless bumping a major version is okay for such a small change.

@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants