ds300 / react-native-typescript-transformer

Seamlessly use TypeScript with React Native
MIT License
657 stars 50 forks source link

Allow bypassing babel #17

Open ds300 opened 7 years ago

ds300 commented 7 years ago

It is possible to write TS code such that Babel is not required to post-process TS compilation results. It would be a nice perf win for people in those situations if they could somehow prevent babel from being used.

For this feature, it doesn't make sense to inspect configuration options in tsconfig because they are not concrete enough to reliably express user intentions regarding babel usage.

I'm thinking that the best thing to do in the long run would be to expose an api to allow users to wrap and configure the transformer. Then they could point the bundler to their own transformer implementation.

ahanriat commented 6 years ago

@ds300 What about Typescript transformer support in Babel 7?

ds300 commented 6 years ago

Yes! Babel 7 can transpile TypeScript, which is amazing and makes this library obsolete. Couldn't be happier to have a thing I've built become useless :D

Karsens commented 6 years ago

Hey @ds300 do you recommend using this or babel 7 with typescript-plugin if I want to start with a new expo project right now? Also, do you know where I can find good documentation for babel 7 typescript & expo?

ds300 commented 6 years ago

@karsens I think you will save some time if you use this library still, however I know of one team who have tried out babel 7 successfully, with the caveat that babel can't have both the typescript and flow plugins at the same time, so you end up needing to strip all the flow types from node_modules in a separate step.

See here: https://github.com/artsy/emission/pull/780

strayer commented 6 years ago

Seems like the newest React Native RC does use Babel 7. https://github.com/facebook/react-native/releases/tag/v0.56.0-rc.2

Did anyone already try using TypeScript directly with that version?

GeeWee commented 6 years ago

Babel has some limitations - in regards to e.g. things like const enums, as it only transpiles one file at a time. For many things, babel should work fine, but not for all. (Though if this transformer uses transpileModule internally, I think it has the same limitations)