"uncovered code" warning from flow
Closed this issue · 2 comments
nitingupta910 commented
Although I'm not getting any error when using idx, I'm getting "uncovered code" wherever idx is used. Using flow 0.61.0, idx 2.2.0, babel-plugin-idx: 2.2.0.
Example:
index.js
// @flow
import idx from 'idx';
type User = {
user: ?{
name: string,
friends: ?Array<User>,
}
};
const props: User = { user: null };
// Uncovered code warning from flow for arrow function below
idx(props, _ => _.user.friends[0].user.friends)
flow coverage index.js
Covered: 56.25% (9 of 16 expressions)
flow coverage index.js --pretty
{
"expressions":{
"covered_count":9,
"uncovered_count":7,
"uncovered_locs":[
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":12,"offset":232},
"end":{"line":14,"column":12,"offset":233}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":17,"offset":238}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":22,"offset":243}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":30,"offset":251}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":33,"offset":254}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":38,"offset":259}
},
{
"source":"/Users/ngupta/progjs/idx_sample/index.js",
"type":"SourceFile",
"start":{"line":14,"column":17,"offset":237},
"end":{"line":14,"column":46,"offset":267}
}
]
}
}
panagosg7 commented
Hi @nitingupta910!
This has probably been addressed in more recent versions of Flow, since I cannot reproduce your case. I'm using Flow version v0.71.0
and idx@2.3.0
which I installed through yarn. Then I did:
$ flow coverage index.js
Covered: 100.00% (16 of 16 expressions)
Note that:
$ flow type-at-pos index.js 2 9
$Facebookism$Idx
index.js:2:8,2:10
and
flow type-at-pos index.js 14 42
?Array<User>
index.js:14:40,14:46
nitingupta910 commented
@panagosg7 I just moved my codebase to typescript so can't verify this, anyways thanks for looking into it.