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

[Feature] Support for Auto-Accessors in classes #3009

Closed
ncpa0cpl opened this issue Mar 21, 2023 · 0 comments
Closed

[Feature] Support for Auto-Accessors in classes #3009

ncpa0cpl opened this issue Mar 21, 2023 · 0 comments
Labels

Comments

@ncpa0cpl
Copy link

TypeScript has introduced auto accessors in version 4.9, currently esbuild (version 0.17.12) does not support this syntax and builds on typescript files that use this feature are outright failing with the following error:

✘ [ERROR] Expected ";" but found "text"

    src/index.ts:82:11:
      82 │   accessor text = "";~~~~
         ╵            ;

Error: Build failed with 1 error:
src/index.ts:82:11: ERROR: Expected ";" but found "text"
  at failureErrorWithLog (~/app/node_modules/esbuild/lib/main.js:1636:15) 
  at ~/app/node_modules/esbuild/lib/main.js:1048:25
  at ~/app/node_modules/esbuild/lib/main.js:993:52
  at buildResponseToResult (~/app/node_modules/esbuild/lib/main.js:1046:7)
  at ~/app/node_modules/esbuild/lib/main.js:1075:16
  at responseCallbacks.<computed> (~/app/node_modules/esbuild/lib/main.js:697:9)
  at handleIncomingPacket (~/app/node_modules/esbuild/lib/main.js:752:9)
  at Socket.readFromStdout (~/app/node_modules/esbuild/lib/main.js:673:7)
  at Socket.emit (node:events:513:28)
  at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: [Object],
      notes: [],
      pluginName: '',
      text: 'Expected ";" but found "text"'
    }
  ],
  warnings: []
}

At the very least ESBuild should be able to parse files that use accessors and leave them as is, in case the target is ESNext. Though it'd be best if ESBuild could generate similar output to TypeScript and transform accessor to get and set functions for any target older than ES2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants