How to use third-party .flow files?

I am working on adding flow to a React.js application. I used flow-typed to add a few packages that seem to work.

This problem is that I am using the UI material form . They do not have a repo in a stream type, but they provide Component.js.flow files.

However, I get this error:

 Error: src/NotFound/NotFound.js:6 6: import Button from 'material-ui/Button' ^^^^^^^^^^^^^^^^^^^^ material-ui/Button. Required module not found Error: src/NotFound/NotFound.js:8 8: import { withStyles } from 'material-ui/styles' ^^^^^^^^^^^^^^^^^^^^ material-ui/styles. Required module not found 

My .flowconfig :

 [ignore] <PROJECT_ROOT>/node_modules/.* <PROJECT_ROOT>/build/.* <PROJECT_ROOT>/scripts/.* <PROJECT_ROOT>/coverage/.* <PROJECT_ROOT>/config/.* .*\.test\.js [include] [libs] <PROJECT_ROOT>/flow-typed/.* [lints] [options] emoji=true 

I tried several solutions in the support forums, but I still don't understand how to do this.

Important package versions:

 react@15.5.4 material-ui@1.0.0-beta.8 flow-bin@0.54.0 
+5
source share
1 answer

The thread does not consider that material-ui exists because you explicitly ignore all files in node_modules in .flowconfig . Delete the first line under [ignore] ( <PROJECT_ROOT>/node_modules/.* ) and you should be good to go.

Please note that some other libraries may cause stream problems. You should just ignore these selectively, and not the blanket to ignore all third-party libraries.

+2
source

Source: https://habr.com/ru/post/1271577/


All Articles