facebook / facebook/flow

Invalid converage about parametrized elements involving type any

Open
#3,860 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Transmitting data though type `any` is reported as uncovered, and this is a desirable behaviour.
However, transmitting data through something parametrized by `any` is not reported as uncovered, and this is a nest for bugs.

```javascript
// wild casting through any is reported as uncovered
function simpleTest () : void {
const simple_any : any = 1
const simple_string : string = simple_any
}

// wild castring through Array in NOT reported as uncovered
function arrayTest () : void {
const array_any : Array = [1, 2, 3]
const array_string : Array = array_any
}

class Storage {
n : N;

constructor(n : N) {
this.n = n
}
}

// wild castring through a class in NOT reported as uncovered
function classTest () : void {
const storage_any : Storage = new Storage(1)
const storage_string : Storage = storage_any
}

// wild casting throught other types is reported as an error
function classTest2 () : void {
const storage_int : Storage = new Storage(1)
const storage_string : Storage = storage_int
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.