-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
React Native 0.56.rc-5 no longer works without Flow #20030
Comments
Uhm... I'm confused, are you sure that that module works properly? Which commit in rc5 do you think could have created the regression compared to rc4? |
@kelset I can ensure you that my app was working before I upgrade to Worth to mention, I am using |
@yordis I think that you want #20015, this issue is when specifically and intentionally removing the @kelset I was actually installing rc.4 instead of rc.5, thinking it was the latest. While still at the rc.4 I configured babel to use TypeScript instead of Flow, and then published that config as Upon investigating more, I think that it actually only worked in rc.4 since I was using a small subset of the react native library which happened to not contain any It seems like React Native isn't transpiled before publishing to Npm, and thus it's not JavaScript that gets published, it's Flow. Is this intentional? My goal is to be able to use the Babel 7 to transpile my TypeScript source so that I can write my React Native app in TypeScript. But since Flow and TypeScript cannot be active at the same time in Babel, I cannot have the Flow plugin activated. Currently, I cannot consume the React Native library when not using the Flow plugin since the published files have |
I'm also having the same problem in the final
|
👋 Linus! That said, I feel that the solution to this may somewhat be related to the other issue you linked (#20015) - we are currently investigating it with the core. In the meantime, to use Typescript, have you checked if you can use the approach explained here? |
Thanks for pointing me to that TypeScript guide. The drawback of that approach is that it a two-step build time, first compiling the TypeScript with |
Hey Linus, thanks for the explanation. Not using TS myself I have to rely on other people in the core / in the FB internal team to understand how doable what you propose is - yesterday I brought this up in a twitter discussion about RN & TS so hopefully now @axe-fb will be able to talk with the metro team and let you know something more. |
Awesome, thank you! Regarding making TypeScript work out of the box, I actually think that it should be quite easy to add that in a very non-obtrusive way. If we can:
Then TypeScript support would just work by renaming files to .ts(x) instead of .js(x), I think that would be amazing 😍 note that it would not require installing TypeScript for people not using it since it would use Babel instead of |
Awesome! (moreover, this could be turned into an RFC as soon as we agree with the core where the new RFC repo will be) |
I'm following react-native-community/releases#38 and are ready to submit an RFC as soon as the process is ironed out |
Neat! Sounds good – I'm playing catch-up at work but will take a deeper dive into the RFC PR and this issue on the weekend. |
👋 folks! |
Yeah, I saw that. I'll open a new one since it was closed because of the old version problem, this time without the version of the I'm still very interested in getting this working! I saw that a newer Babel landed in the metro project. With that babel the TypeScript preset is configured to only consume Anyhow, if we just modify the react-native-preset we can easily load typescript for The only problem is the closed issue, I'm not sure of the cause either. If it has something to do with the internals of Metro, or if it's just that the config for |
Understood - anyway, can you please ping me via Twitter DMs so we can try to coordinate around this without polluting the issue too much? |
@duro I don't think so since Babel doesn't use the This would just enable Babel to read .ts files, and to strip type information. But it wouldn't actually validate that the TypeScript types are valid. For that the user would have to use e.g. edit: You would be able to continue to use VS Code with Also, Flow is already enabled in the current React Native babel config, so if it works now, it should continue to work 👍 |
So it seems that publishing Flow files to npm instead of JS is intentional. Flow is a requirement in the built system. The good news is that #20088 is fixed in Babel beta.48, which should ship with the next metro which should be shipped with React Native 0.57 (the first RC should drop today). The even better news is that native TypeScript support has been merged to Metro as well 🎉 With that, I'm going to close this bug |
Environment
Description
Starting with version 0.56.0-rc.5, I can no longer compile my app without the Flow plugin included in my babel config. This is unfortunate since I'm using TypeScript instead of Flow, and the babel plugins for TS and Flow cannot be enabled at the same time.
This works in 0.56.0-rc.4 and thus seems to be a regression.
Reproducible Demo
babel-preset-react-native
forbabel-preset-react-native-typescript
.I haven't dug in too deep yet, but it seems like maybe the files weren't transpiled prior to being published to npm?
The text was updated successfully, but these errors were encountered: