facebook / facebook/flow

For an unknown index into a tuple, Flow neglects potential void types resulting from out of bounds access

Open
#4,264 1 comment 0 reactions 0 assignees View on GitHub
Typing: tuple
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

The tuple docs claim that "If Flow doesn’t know which index you are trying to access it will return all possible types," but Flow neglects the possible void type:

```js
declare var p: [number];
declare var n: number;
(p[n]: number); //ng, but Flow passes.
(p[n]: number | void); //ok
```

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.