Skip to content

Start adopting Flow strict mode - #8281

Merged
mourner merged 6 commits into
masterfrom
flow-strict-test
May 29, 2019
Merged

mourner merged 6 commits into
masterfrom
flow-strict-test

Conversation

@mourner

@mourner mourner commented May 23, 2019 •

Copy link
Copy Markdown
Member

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.

@asheemmamoowala asheemmamoowala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Comment thread src/util/window.js Resolved
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