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
Small flow fixes #7634
Small flow fixes #7634
Conversation
@@ -16,14 +16,14 @@ import type { ReactPropTypeLocations } from 'ReactPropTypeLocations'; | |||
|
|||
type NamesType = {[key: ReactPropTypeLocations]: string}; | |||
|
|||
var ReactPropTypeLocationNames = {}; | |||
var ReactPropTypeLocationNames: NamesType = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the exported type seemed to be "object literal" and I couldn't index into it with a ReactPropTypeLocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the issue that I raised where flow doesn't have a way to have a variable defined only in __DEV__
, the workaround is to always set the type to what's in __DEV__
as you just did.
Why wasn't this caught by our Flow? Are we on a different version? |
I'm guessing probably for the same reason #7610 wasn't caught here - no flowified modules flow into here but in www it does happen. |
Yeah, there are some www (flow) files using these internal modules. |
i see. Should we Flowify tests? |
One tricky thing we flow is that if your call sites aren't using flow, you can write wrong annotations and if they do not conflict within the file, flow will let you write them. As you convert the callsites, you start seeing flow errors on those. The solution for that is to add more flow types so that they get better over time :) |
Small flow fixes (cherry picked from commit 0c62d12)
Needed for www (and correctness).