react-native-typescript-transformer icon indicating copy to clipboard operation
react-native-typescript-transformer copied to clipboard

Allow bypassing babel

Open ds300 opened this issue 7 years ago • 6 comments

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.

ds300 avatar Jun 29 '17 07:06 ds300

@ds300 What about Typescript transformer support in Babel 7?

ahanriat avatar Sep 23 '17 17:09 ahanriat

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

ds300 avatar Sep 23 '17 20:09 ds300

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?

Karsens avatar Nov 02 '17 08:11 Karsens

@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

ds300 avatar Nov 02 '17 09:11 ds300

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?

strayer avatar Jun 18 '18 15:06 strayer

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)

GeeWee avatar Jul 03 '18 10:07 GeeWee