You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the minifier to process JavaScript code that includes optional chaining with bracket notation, such as a?.["b"], the output is incorrect. This issue appears to be the root cause of #744 , where similar behavior was observed. The specific problem lies in how the minifier transforms a?.["b"] into a?..b, which is invalid JavaScript.
The last line of the output console.log(a?..b) is incorrect. The minifier improperly handles the bracket notation in optional chaining, resulting in invalid JavaScript syntax.
Expected Behavior
The minified code should correctly preserve the bracket notation in optional chaining. The expected output should be:
Description
When using the minifier to process JavaScript code that includes optional chaining with bracket notation, such as
a?.["b"]
, the output is incorrect. This issue appears to be the root cause of #744 , where similar behavior was observed. The specific problem lies in how the minifier transformsa?.["b"]
intoa?..b
, which is invalid JavaScript.Reproduce
In
js/js_test.go
go test --run TestOptionalChainingWithBracket -v
output:
The last line of the output
console.log(a?..b)
is incorrect. The minifier improperly handles the bracket notation in optional chaining, resulting in invalid JavaScript syntax.Expected Behavior
The minified code should correctly preserve the bracket notation in optional chaining. The expected output should be:
The text was updated successfully, but these errors were encountered: