Here is a minimal repository with the bug: https://github.com/ckknight/flow-libs-bug
On line 6 of src/App.js, this.props.nonexistent() is called, which _should_ be a type error.
By having the following lines in .flowconfig:
[libs]
flowlib/
and a file within that folder:
// @flow
import { Component } from 'react';
declare module 'foo' {
declare module.exports: any;
}
Regardless of whether foo is referenced anywhere else, the import { Component } from 'react'; line causes flow to view Component as any within unrelated code.
In #5678, which refers to the same issue as this one, it was explained that imports outside of module declarations are not supported, so I think this issue can be closed now.
it should be import type { Component } from 'react' instead
and you could also use React$Component in some cases
@sibelius Sorry, I'm unclear as to whether imports outside of module declarations are supported or not?
@sibelius sure it _should_ be import type { Component } from 'react'. Instead, my errors were completely swallowed with zero indication that there was a problem. That's the real issue.
Closing in favour of the referenced issues
Most helpful comment
@sibelius sure it _should_ be
import type { Component } from 'react'. Instead, my errors were completely swallowed with zero indication that there was a problem. That's the real issue.