Skip to content
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

Cannot combine flow and typescript plugins (babel-preset-react-native and babel-preset-typescript) #20283

Closed
adrienharnay opened this issue Jul 18, 2018 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@adrienharnay
Copy link
Contributor

adrienharnay commented Jul 18, 2018

Environment

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
      Memory: 602.64 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.5.0 - /usr/local/bin/node
      Yarn: 1.7.0 - ~/Documents/GitHub/brigad-front-end/node_modules/.bin/yarn
      npm: 6.1.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3
        API Levels: 23, 25, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4670197
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1
      react-native: 0.56.0 => 0.56.0

Description

Since babel7, we can use @babel/preset-typescript to transpile typescript files seamlessly. Unless, babel-preset-react-native ships with flow, and an error happens: Cannot combine flow and typescript plugins. @babel/preset-react and @babel/preset-create-react-app both addressed the issue, either by removing the flow preset by default, or adding an option to disable it (link and link).

Would either solution be possible?

Reproducible Demo

https://github.com/adrienharnay/babel-preset-react-native-conflict-repro

Thanks in advance!

Edit: it appears that disabling @babel/plugin-transform-flow-strip-types breaks the RN build. Is there any option for flow and typescript to live together?

@adrienharnay
Copy link
Contributor Author

Fixed by facebook/metro#192

@shuangyu

This comment has been minimized.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 23, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants