Skip to content
New issue

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

incorrect parse of parenthesized array literal #2375

Closed
SheetJSDev opened this issue Jul 7, 2022 · 1 comment
Closed

incorrect parse of parenthesized array literal #2375

SheetJSDev opened this issue Jul 7, 2022 · 1 comment

Comments

@SheetJSDev
Copy link

Shortest test case:

0?([]):1; 

Test:

% npx esbuild@latest test.ts --outfile=test.js --platform=browser --target=es5
✘ [ERROR] Transforming destructuring to the configured target environment ("es5") is not supported yet

   test.ts:1:3:
      1 │ 0?([]):1; 
        ╵    ^

The carat is pointing to the open square bracket

The error is elicited by the ternary expression when the truthy part is a parenthesized array, irrespective of the number of elements.

@susiwen8
Copy link
Contributor

susiwen8 commented Jul 8, 2022

https://github.com/evanw/esbuild/blob/master/internal/js_parser/js_parser.go#L2655
esubild might mistake ([]): or({}): as arrow function

@evanw evanw closed this as completed in a2789bf Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants