-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Decorators on methods in object literals #3062
Comments
Wow, I don't know legacy decorator could be applied to object literals until today |
Me, too. |
Yeah, I.want to support it. |
Same issue with import 'reflect-metadata';
import { Type } from 'class-transformer';
export class DeliveryGenericData {
/** Packages. */
@Type(() => PackageDto)
packages?: PackageDto[];
} SWC error (using it with Webpack):
.swcrc {
"jsc": {
"target": "es2020",
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true
},
"keepClassNames": true,
"externalHelpers": true,
"loose": false
},
"module": {
"type": "es6",
"strict": true,
"noInterop": true
},
"exclude": ["./src/**/.*.spec.ts$", "./**/.*.js$"],
"sourceMaps": true
} |
@
. Expected identifier, string literal, numeric literal or [ for the computed key
just encountered the same bug using class-transformer lib and decorators ( are there any updates on this issue? |
Same problem with typegraphql |
From Typescript v5, new stage 3 ECMA script decorators are implemented by default but it seems @swc/jest does not support it. Is there any plan for this? |
@miso-belica The stage 3 proposal is implemented, but it does not include decorators in object literals. Decorators on object literals will not be supported unless they get promoted to stage 3 |
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
I want change babel to swc in a vue2 project. But i have a little problem.
index.vue
.swcrc
swc will throw an error:
Error: error: Unexpected token
@. Expected identifier, string literal, numeric literal or [ for the computed key
but when i use babel and enable
legacy
mode, it works.anyway, thank you first
Input code
No response
Config
No response
Playground link
https://play.swc.rs/?version=1.2.120&code=H4sIAAAAAAAAA0utKMgvKlFISU1LLM0pUajmUlDITS3JyE8ptgJzFBQccvITUzLz0hXAvPTUEr%2FE3FQNTaisgkJyfl5xfk6qXk5%2BuoZ6HlBOXRMsU8sFwrVcACMr6%2F9iAAAA&config=H4sIAAAAAAAAAzXLSwqAMAxF0b28cVfQsRsJMYpiPyQRLKV7l4LO7uDcjtMYsaOSmugsa9npQYRwImM9qiNgFS5KXtQQXW8ZAa6UbSua5nXJTtyWX31ojBcy%2BVj2YQAAAA%3D%3D
Expected behavior
it works
Version
1.2.120
Additional context
No response
The text was updated successfully, but these errors were encountered: