Stream type "Not covered by stream" in object property chains

I'm trying to use Flow, but I keep getting the “Not Covered by Flow” warning, so my code is mostly underlined. I checked the Flow documentation, but that didn’t help link the property chain of the object, so how can you work on this?

image

+7
flowtype
source share
2 answers

It looks like you are using a library that does not have type definitions.

With the search for properties where the object is defined in the file, Flow has coverage of 100% of the code without any types:

const foo = { bar: { baz: 2 } }; foo.bar.baz; // 100% Flow coverage 

The same applies to individual files:

1.js

 // @flow export default { bar: { baz: 2 } }; 

2.js

 // @flow import foo from './1.js' foo.bar.baz; // 100% code coverage 

However, as soon as something is imported from a file that Flow does not start (either because the stream is disabled, or because of its third-party library that does not use the stream), Flow cannot.

1.js

 // @noflow export default { bar: { baz: 2 } }; 

2.js

 // @flow import foo from './1.js' foo.bar.baz; // 0% code coverage 

To fix this, you need to provide stream information about types.

You can do several different things.

I hope this is useful enough to give you at least a starting point.

+3
source share

I am also new to Flow, but heres my take:

If you have two classes: A and B, and flow type checking is not enabled on A, then the functions of B that are called in it will be "uncovered".

 // a.js class A { } // b.js /* @flow */ import A from './A' class B { buildA():void { new A() // I'm un-covered by Flow! } } 

Flow knows nothing about structure A and therefore cannot guarantee any guarantees.

0
source share

All Articles