I am following react native blog post about working with typescript: http://facebook.github.io/react-native/blog/2018/05/07/using-typescript-with-react-native
One thing I can't grasp is why we need https://github.com/ds300/react-native-typescript-transformer alongside custom rn-cli config?
To my understanding we can transpile ts to a folder like dist
and include main App
from there in our root level index.js
file.
For this to work a simple script that launches typescript compiler alongside react native one will do the trick or am I missing something.
React Native uses a module bundler called Metro, and the react-native-typescript-transformer
plugin allows it to build your project's TypeScript files as part of the bundling process much like how you can use the Webpack plugin to transform TypeScript files as a part of its bundling process.
With both Metro and Webpack you pre-build your TypeScript files with tsc
instead of using a bundler plugin if that's what you'd prefer - this is just an alternative to doing that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With