-
Notifications
You must be signed in to change notification settings - Fork 48
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
Is this needed anymore? #86
Comments
For me, yes. Babel does not supports |
I agree we still need this library because of problems with Babel 7 (namespaces, enums, generated code not compatible with the default Android JSC, ...). But how do you configure Metro to still use |
@chawax , my rn-cli.config.js : /* eslint-env node */
module.exports = {
transformer: {
babelTransformerPath: require.resolve('react-native-typescript-transformer'),
},
} |
Thanks, I will give it a try when I'll be at work tomorrow ! |
It works ! You saved my life 👍 I was thinking about giving up Typescript in my React Native project because of this ! |
my rn-cli.config.js:
|
@fantasy525 Your solution will not work with React Native 0.57.4 if you use enums or namespaces because the Babel 7 Typescript transformer will be used. |
so this can work with rn 0.57.4?
|
Yes, exactly 👍 |
Babel7's typescript also does not support emitting decorator metadata - disabling a lot of decorator based typescript libraries such as TypeDI and TypeORM. Also, we really need to update the docs to fix this - just spent 2 hours debugging metro-loader before finally deducing this was the solution also. |
Hi,I find this configuration can work at rn 0.57.5
|
@chawax Hey you said that the compiled TS code with babel is not working on React Native Android? Can you send link to this issue because I havent heard of it 🤔 ? |
Here is a link on the bug I encountered : facebook/react-native#21074 It looks like TS code compiled with Babel is not compatible with some Android versions (< 5.0) and also with iOS 9.3. |
So you are saying that if I want to support Android < 5.0 and iOS <= 9.3 then I still have to use react-native-typescript-transformer to compile my code? But if I don't support these OS versions then I can use babel to do the transforming? :) |
@aMarCruz One day I'll travel to Mexico and invite you for 🍺 |
@henrikra Well it probably depends on your project. The problem might come from a library I include in my project or from the Typescript code I generated from Swagger. If it is not the case for your project, Babel 7 TS compilation may work. Just give it a try on a Android 4.4 emulator for example ;) |
I would appreciate if you update the readme. |
I updated the readme |
I think it is very necessary,the typescript compiler knows typescript better than Babel,I'll keep using this until Babel converts typescript with fewer problems,thank you! |
I was just thinking is this library needed anymore since you can use Babel 7 to compile TypeScript 🤔
The text was updated successfully, but these errors were encountered: