upgrade-support
upgrade-support copied to clipboard
React Native 0.66 yarn flow throws an error: Cannot resolve name symbol
Environment
System: OS: macOS 11.5.2 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 31.26 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node Yarn: 1.22.5 - ~/.yarn/bin/yarn npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 23, 24, 25, 26, 27, 28, 29, 30 Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.0, 27.0.1, 27.0.3, 28.0.3, 29.0.0, 29.0.2, 30.0.2 System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.4 AI-183.6156.11.34.5692245 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_151 - /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.0 => 0.66.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Things I’ve done to figure out my issue
Used npx react-native upgrade
- [ ] I used upgrade-helper to do my upgrade.
Upgrading version
From 0.65.1 to 0.66.0
Description
yarn flow or yarn run flow started throwing error after the upgrade to React Native 0.66.
There were no flow error in 0.65.1
Getting this error in 0.66
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native/flow/global.js:22:13
Cannot resolve name symbol.
Flow version in my project "flow-bin": "^0.93.0"
Workaround: Put below line in flowconfig [options] suppress_type=symbol
Reproducible demo
Sorry. No reproducible demo
Have you tried upgrading your project to flow-bin@^0.161 (and updating your [version] in your .flowconfig)?
Have you tried upgrading your project to flow-bin@^0.161 (and updating your
[version]in your.flowconfig)?
Yes, I have tried it but the upgrade was throwing many more flow errors. So, we decided to not upgrade flow-bin to the latest version
That's right. There is a breaking change from Aug. 2021 that defines libdefs for global.
symbol requires our app to upgrade flow-bin. But there would be 3000 errors if we are to upgrade flow-bin.
Of course it also happens on 0.67, which is my case.
https://github.com/facebook/react-native/commit/b931aa735fcbefe40eccd8344ae28ab6eec06930#diff-8e2bb02db9a4005520f4b9cebefa762b0c3b0e289f9363e0d3472c284e2c6d2f
This is the commit where the breaking change was created.
We didn't want to update Flow in our project, so I just added a patch using patch-package:
diff --git a/node_modules/react-native/flow/global.js b/node_modules/react-native/flow/global.js
index b2e76fe..ea6cec7 100644
--- a/node_modules/react-native/flow/global.js
+++ b/node_modules/react-native/flow/global.js
@@ -64,5 +64,5 @@ declare var global: {
+RN$Bridgeless?: boolean,
// Undeclared properties are implicitly `any`.
- [string | symbol]: any,
+ [string]: any,
};