Doomed to Recode: Adventures in Flow
Alright. I’m starting this little dev blog not because I have something new for the reader to learn or know of some really great js libraries. I’m writing this 95% for me and 5% for you. I felt the need to document my day wasting problems somewhere so I don’t repeat those mistakes. Maybe you’ll benefit.
Setting: VS Code, create-react-app, using Flow Language Support plugin
Issue: Flow infinite loading / stuck
Works on my computer: Enter “flow stop” into the terminal at the root of your project. Sometimes the flow server is running and blocking it from starting up again.
Issue: My VS Code intellisense is broken / not working! VS code peek isn’t working. Neither is VS code go to definition!!
Works on my computer: Perhaps like me, you were looking at the Flow Language Support and disabled the Typescript extension because A) They suggest that and B) who needs Typescript if you’re going to be using flow? Turns out that extension is what provides the intellisense, peek and go to definition capabilities. Instead of disabling it, set javascript.validate.enable to false in your vscode settings.
Issue: VS Code Intellisense is slow! Sometimes it works at first and the stops working!
Worked for me: It’s what you might expect, you’re computer is too slow to run it. Make sure to close unnecessary chrome tabs, programs, and… for me it was disabling Shadow Play (wups).
Issue: A lot of packages that I use have their types defined with TypeScript! Can Flow read TypeScript type definitions???
Works for me: Check out this package flow-typed. Once you install this globally, you can just go to your root project folder and run the command
flow-typed install
This will check your package.json and see which ones have their types defined with TypeScript and load package specific Flow types into your project. You can also install types from specific packages. It’s pretty neat!