Depending on the context, there are cases where dynamically typed languages are better match and cases where statically typed languages are better suited. When you want to get something simple done quickly, then strong and static typing system might feel like overkill and something like NodeJS + Express might be the ideal fit.
When the application domain is large and complex, involving a lot of data manipulation, then statically typed languages might help you in taming the domain. But as always in matters related to programming and technical decisions, your mileage may vary.
You can configure ESLint to enforce the level of additional type annotations you want to have for your project. In my example project, I have configured ESLint to enforce type annotation on function parameter types and return types. Now that my editor is aware of this, it will highlight the erroneous lines.
To play it really safe I have ESlint with Flow configured in my “pre-commit”-hook, which is configured in package.json. This gives me fast feedback from my editor and the safety before committing changes to Git.
So what kind of magic does Flow do under the hood? In the transpiled code below we can see Flow adding a few lines for checking the parameters and the return value as seen in the screenshot below. This might bring a very small performance impact, but nothing to worry in this case.