We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ChainExpression
AssignmentExpression
Source:
(foo?.bar).qux = 1;
Output from codegen:
foo?.bar.qux = 1;
Playground
This output is not legal. "SyntaxError: Invalid left-hand side in assignment"
Same problem with (foo?.()).bar = 1.
(foo?.()).bar = 1
The text was updated successfully, but these errors were encountered:
refactor(codegen): only print necessary parentheses in TSAsExpression (…
7040a28
…#6429) Part of fixing #6385
702b574
fix(codegen): preserve parenthesis for ChainExpression (#6430)
02bfbfe
close: #6385 The fixing way was referenced from `esbuild`, it is according to these [states](https://github.com/evanw/esbuild/blob/332727499e62315cff4ecaff9fa8b86336555e46/internal/js_ast/js_ast.go#L590-L604 )(determined in the parser) to determine whether to print parenthesis Due to differences in implementation details, we are unable to record certain information like `esbuild` does in its parser. But fortunately, The `ParenthesisExpression` AST is actually like what `esbuild` stored states.
Dunqing
Successfully merging a pull request may close this issue.
Source:
Output from codegen:
Playground
This output is not legal. "SyntaxError: Invalid left-hand side in assignment"
Same problem with
(foo?.()).bar = 1
.The text was updated successfully, but these errors were encountered: