react-native-typescript-transformer
react-native-typescript-transformer copied to clipboard
Support for the experimental syntax 'decorators-legacy' isn't currently enabled
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
I got the same problem
@super918180 I fixed this issue with following steps:
- Install
@babel/plugin-proposal-decorators
- Change .babelrc https://pastebin.com/QdddctRN
But I'm not sure that it is right way.
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
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!
still bug decorators-legacy' isn't currently enabled
@andrey-shostik thanks! Could you please explain how your solution works?
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 }]
]