benjamn / benjamn/recast

Transforming destructure reassignment results in extra parenthesis

Open
#533 2 comments 0 reactions 1 assignee Claimed by @benjamn View on GitHub
Dominant language
TypeScript
Stars
5.3k
Forks
363
Avg merge
3d 8h
Merged PRs (30d)
3

Description

If I translate code with a destructuring reassignment, i.e. destructuring syntax, outside of a VariableDeclaration, e.g. `({ foo } = bar);`, then the result ends up wrapped in an additional, unnecessary layer of parentheses, e.g. `({ foo } = bar))`.

([Example from AST Explore](https://astexplorer.net/#/gist/b47c693765df745a606b383295251da7/3b4ab99513b2de8f149bb5a145ce85f60a4a5eb7))

I believe this to be largely the same underlying causes as #327 , so I suspect there's nothing to be done about it, at the moment, but I thought it'd be worth opening an issue to track it nonetheless.

(Sorry for some edit noise, here. I accidentally posted this way before it was ready to be posted)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.