Errors encountered upgrading Flow v0.85, and how we solved them

Tan Li Hau
4 min readAug 26, 2019

This is a repost from https://lihautan.com/errors-encountered-upgrading-flow-0.85/

Background

Despite seeing the JS community slowly moving away from Flow to TypeScript, Shopee Web Frontend codebase is still very much stuck with Flow. 😨

After some silence, Flow has come back and committed to be a more efficient, reliable and friendly tool. Thus, we decided to give Flow a final chance. However, in order to enjoy the improvements that Flow has made in recent days, we have to upgrade Flow from 0.83 (since our last update) to v0.97 (latest to date), which meant that we need to upgrade past v0.85, which meant hell to codebase that uses react-redux extensively.

One of our brave developer, Gao Wei took up the challenge and decided to bring us to the bright side of Flow. 😅. She twitted and wrote an article on how she fixed the errors arose in the process.

To put the problem in perspective, from Flow 0.85 onwards, Flow is asking for required annotations for implicit annotations. Or less technical, if you are trying to export something that was created from a generic class (eg: class Foo<T>) or functions (eg: function foo<T>(){}), without explicit type arguments (eg: new Foo<Type>() or foo<Type>()), Flow is going to give you an error.

Or in layman terms, if your repo is full of HOCs or connect(), you are f**ked. So, be sure the check Gao Wei’s blog if you are one of the brave…

--

--