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 option "decorators": true, using the name export for class fields and methods is no longer allowed, returning this error:
× `export` is not allowed here
╭─[file.js:3:3]
3 │ export = true;
· ──────
╰────
Caused by:
0: failed to process input file
1: Syntax Error
Error: Failed to compile 1 file with swc.
at Object.assertCompilationResult (/Users/maclockard/workspace/hex-inc/hex/node_modules/@swc/cli/lib/swc/util.js:113:15)
at files (/Users/maclockard/workspace/hex-inc/hex/node_modules/@swc/cli/lib/swc/file.js:173:18)
at async _default (/Users/maclockard/workspace/hex-inc/hex/node_modules/@swc/cli/lib/swc/file.js:192:9)
This error occurs for both syntax "ecmascript" and "typescript". Also worth noting with the same config, the name export is allowed if there is not a decorator on the field.
I would expect swc to be able to compile a class that uses the word export as a field name or method name when using decorators.
Actual behavior
No response
Version
1.2.218
Additional context
Here's an example of typescript compiling the exact same code: playground link (ignore the type error for now, its just because I'm not defining the decorator to keep the code snippet short).
The text was updated successfully, but these errors were encountered:
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
When using the option
"decorators": true
, using the nameexport
for class fields and methods is no longer allowed, returning this error:This error occurs for both syntax
"ecmascript"
and"typescript"
. Also worth noting with the same config, the nameexport
is allowed if there is not a decorator on the field.Input code
Config
Playground link
https://play.swc.rs/?version=1.2.218&code=H4sIAAAAAAAAA0utKMgvKlFIzkksLlbwrXQG09VcCgoOvpUuqcn5RYkl%2BUUamkCBVIhKW4WSotJUa65aAJrlKr86AAAA&config=H4sIAAAAAAAAA0WOQQoDIQxF75K123bhHXqI4GQGy2gkyUBFvHu1WGYX%2Fn%2F%2FkQZvDeAbFBQlmZfWbPgBDxQSapBYDBxsFFjQWBS8yUVuDAe046nUHRjKQTZH%2Bhj0yay0Wgcp5rjX6Q6cipDqXWE%2Bzj%2FZhyjxds2ggdVCP%2BET%2Bu1Yu6ivBc5n%2BhejSMoXxwAAAA%3D%3D
Expected behavior
I would expect swc to be able to compile a class that uses the word
export
as a field name or method name when using decorators.Actual behavior
No response
Version
1.2.218
Additional context
Here's an example of typescript compiling the exact same code: playground link (ignore the type error for now, its just because I'm not defining the decorator to keep the code snippet short).
The text was updated successfully, but these errors were encountered: