Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start adopting Flow strict mode #8281

Merged
merged 6 commits into from
May 29, 2019
Merged

Start adopting Flow strict mode #8281

merged 6 commits into from
May 29, 2019

Conversation

mourner
Copy link
Member

@mourner mourner commented May 23, 2019

This PR demonstrates how we can start tightening up our typing with Flow strict mode:
https://flow.org/en/docs/strict/

Strict mode enables stronger safety guarantees by banning unsafe types such as any, which currently plague our codebase with a false sense of safety, allowing for serious bugs to slip through. any is kind of a virus — any code that touches it gets "tainted", and we used it a lot, leaving its removal for later. As a result, basically the majority of our codebase is unsafely typed (which is often not better than untyped).

Strict mode on the other hand is viral too — you can enable it on a file-by-file basis, and it enforces every import to be strictly typed too. That means we can start with typing "leaves" and external dependencies, and go up the tree until we type out everything.

In this PR, I started with typing a few utility files and a few dependencies. We can merge it to get the config in, and then gradually type the rest of the code base with a succession of minimal PRs.

Copy link
Contributor

@asheemmamoowala asheemmamoowala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants