I have tried searching for the solution or work around to solve this but no success. Here are some steps to describe my flow installation and eventually the issue I am facing.
Step 1: I have created a new react native project using
react-native init TestProject
.
I wanted to configure flow for my project, but there was no .flowconfig file.
As we know that the flow version is needed to be specified for installing flow locally for the project, using the following script:
yarn add --dev [email protected] babel-preset-flow
.
Step 2: Even though I do not have .flowconfig file and hence no information of which specific version of flow to install, I try to install flow for my project using this:
yarn add --dev flow-bin babel-preset-flow
.This has installed the latest flow 0.79.1.
Step 3: To generate .flowconfig file, following script is used:
./node_modules/.bin/flow init
. This created the .flowconfig file in project directory with some default entries as follows:
Step 4: I restarted the VSCode to start flow server:
As the flow server was running, here I found out the there are 98 problems with the react-native library:
Step 5 : I added ./node_modules/. under [ignore] in .flowconfig file and restarted VSCode again.
Step 6 : Now the error caught by flow is, it cannot find the module react-native:
Here is the project's package.json: Here is the React Native Environment Info:
Please suggest if anyone has solved this issue. Thanks in advance.
You can use the [untyped]
* section in your .flowconfig
to tell Flow to treat the files as untyped but still recognise that they exist or even better use the new [declarations]
option to just use the types even when there are errors in the library itself. This will prevent the import problem. In your case you might want to ignore only very specific dependencies because it is generally useful to get the types from libraries that are inside of your node modules.
* Introduced in Flow v0.61.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With