facebook / facebook/flow

`typeof mixed === 'object' && mixed` should not report sketchy-null-mixed

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

Description

Consider these 2 snippets:

```javascript
declare var m : ?mixed;
if (typeof m === 'object' && m) {
/*snip*/
}

if (typeof m === 'object') {
if (m) {
}
}
```

In the first case flow-lint reports a `sketchy-null-mixed` error, while in the second case it does not. I think that flow should not report an error in both cases, since the only falsy value with type === 'object' is `null`.

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.