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

Support for the experimental syntax 'decorators-legacy' isn't currently enabled #81

Open
andrey-shostik opened this issue Oct 11, 2018 · 8 comments

Comments

@andrey-shostik
Copy link

andrey-shostik commented Oct 11, 2018

I recently created app with typescript by this article, and I have error when trying to apply decorator to a method
error screenshots: https://prnt.sc/l4nors, http://prntscr.com/l4np8r
tsconfig: https://pastebin.com/UsczCQ70

@super918180
Copy link

I got the same problem

@andrey-shostik
Copy link
Author

@super918180 I fixed this issue with following steps:

But I'm not sure that it is right way.

@CepheiSigma
Copy link

if you are using latest rn,the rn-cli.config.js should be like this
module.exports = { transformer: { babelTransformerPath: require.resolve('react-native-typescript-transformer'), }, };
you can follow the metro-bundler document
https://facebook.github.io/metro/docs/en/configuration

@eavam
Copy link

eavam commented Dec 23, 2018

if you are using latest rn,the rn-cli.config.js should be like this
module.exports = { transformer: { babelTransformerPath: require.resolve('react-native-typescript-transformer'), }, };
you can follow the metro-bundler document
https://facebook.github.io/metro/docs/en/configuration

It's work for me!

@noer180895
Copy link

still bug decorators-legacy' isn't currently enabled

@br4in3x
Copy link

br4in3x commented Feb 18, 2019

@andrey-shostik thanks! Could you please explain how your solution works?

@tomusiaka2
Copy link

Installing these two plugins and updating babel.config.js seems to be working for me:

  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }]
  ]

@Aseer07
Copy link

Aseer07 commented Aug 25, 2023

Error: Support for the experimental syntax 'decorators' isn't currently enabled
Issue: I'm currently experiencing an issue with Babel when trying to use decorators in my JavaScript code. I've followed the official Babel documentation and created a .babelrc.json file with the necessary configuration, but I'm still getting the error

hers is .babelrc.json
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-transform-runtime",
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties"]
]
}
How to resolve this

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

8 participants