Flow-type
React, ReactJS

Flow: $FlowFixMe command should be $FlowFixYourself. FlowType is dying! 🧐🤔😱

First, let’s talk about what is Flow or FlowType…

From their official site –

FLOW IS A STATIC TYPE CHECKER FOR JAVASCRIPT.

From ReactJS’s site-

Flow is a static type checker for your JavaScript code. It is developed at Facebook and is often used with React. It lets you annotate the variables, functions, and React components with a special type syntax, and catch mistakes early.

Seems fair 👌

If you already used Flow, then you know that in a few cases in your code, Flow is not happy though you think your code is fully okay and should not be modified to make Flow happy.
But as Flow is not happy with that code, the build will break. 😱
So, to bypass the Flow error, we have to add $FlowFixMe before that specific line. 😐

And if you are working with a big codebase, then you probably need to add this thing a lot in a lot of places. 😞

Like, if we go to ReactJS GitHub repo and search for $FlowFixMe in the whole repo, we will find a lot of them in the codebase.

Alt Text

I think, that $FlowFixMe should be $FlowFixYourself 😉

Now, let’s talk about what Facebook is doing to make Flow better.

Actually, they are even removing Flow from their own projects and migrating their codebase to TypeScript.

One of the popular Facebook tools is JEST.

Alt Text

They used Flow on the Jest codebase. Now they have migrated and started using TypeScript.

Alt Text

So, as Facebook developers are also removing FlowType from their projects, what do you think about it?

Do you wanna use it for your projects or remove it?
Do you think they will make it better?

Cheers!
👋

As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these ❤️😊🌸

Buy Me A Coffee

I will provide some reference URLs for you guys to look more-

https://github.com/facebook/flow/issues/7365

To see FlowFixMe search result in ReactJS reop, 👉 Click here

To see HackerNews Thread 👉 Click here

Standard

Leave a Reply

Your email address will not be published. Required fields are marked *