Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

"uncovered code" warning from flow #43

Closed
nitingupta910 opened this issue Dec 10, 2017 · 2 comments
Closed

"uncovered code" warning from flow #43

nitingupta910 opened this issue Dec 10, 2017 · 2 comments

Comments

@nitingupta910
Copy link

nitingupta910 commented Dec 10, 2017

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
Copy link

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
Copy link
Author

@panagosg7 I just moved my codebase to typescript so can't verify this, anyways thanks for looking into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants