Misplaced parenthesis in object destructuring argument with trailing argument comma
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
I haven't been able to pin down exactly why this is happening, but here's my smallest reproduction so far. I'm using `flow` the parser.
```javascript
class Foo {
method = item => {
return (
);
};
}
function x({ className, }) {
}
```
gets printed as
```javascript
class Foo {
method = item => {
return (
);
};
}
function x({ (className, })) {
}
```
Note the extra (and mis-nested) parenthesis in the last function.
Interestingly, changing just about anything about the code above causes the problem to go away.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the supplied JavaScript reproduction through the Flow parser and comparing the printed output with the input around the destructuring argument and trailing comma. The issue is done when that reproduction prints without the misplaced parentheses and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100