Repository navigation
A binding pattern without rest element can have a trailing comma #24628
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptHelp WantedYou can do thisYou can do this
on Jun 4, 2018 PRs welcomed.
thanks @alexandrLamdan1995
Mohamed Hegazy (@mhegazy) I'm still seeing this on master:
$ cat in.ts let a; [a,] = <any>[]; $ git rev-parse --short HEAD 7eaa78846e $ gulp local [...] $ node built/local/tsc.js in.ts in.ts:1:10 - error TS1013: A rest parameter or binding pattern may not have a trailing comma. 1 let a; [a,] = <any>[]; ~Looks like this was introduced in #22262. I'll submit a PR in a moment here.
Will anyone try to fix it? Windows update - crash + BSOD, skype update - crash, Typescript update - crash. Do you have testers for your own products? The worst QA in all over the world... And that is Microsoft.
Reacted by Jake StangerReacted by Pavel Birukov , James D. Callahan III, Michael Loughry, Gitowiec, jaa1982, Linjie Ding, Alexander Kachkaev, Vedran Marsic, Kai, Guillaume and 4 moreReacted by Lazar LjubenovićReacted by Vadym MilichevIt’ll be fixed by #24672 @BLRplex.
Jed Fox (@j-f1) Hope it will not reopened again in few days. Thanks
Reacted by Vadym Milichev, James D. Callahan III, jaa1982 and Pavel BirukovReacted by Jed Fox, jaa1982 and Alexander Kachkaev- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on Jun 6, 2018 Can this fix make it into into an earlier release, e.g., 2.9.2? We use Prettier and either we have to rip out all trailing commas or upset the TS compiler to update to 2.9.
Reacted by Andrew Boyton, Huy Nguyen, avin-shum and Erin HoopsAs a workaround for anyone who stumbles into this issue, you can just append
// prettier-ignoreto an offending line and Prettier will not add a trailing comma there to satisfy TS.Reacted by Andrew Boyton, Bohdan Khodakivskyi and avin-shum- added 2 commits that reference this issue
on Jun 14, 2018 - locked as resolved and limited conversation to collaborators
on Oct 21, 2025
TypeScript Version: 2.9.1/3.0.0-dev.20180602
Search Terms:
Code
Expected behavior:
no error
Actual behavior:
Per ECMAScript Spec, the trailing comma is allowed in a binding pattern without rest element.
Playground Link:
link
Related Issues:
(from prettier/prettier#4624)