Flow doesn't propagate refinement information through variable
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Flow version: 0.96.0
## Expected behavior
Null check assigned to variable should prevent flow error: property missing in null
## Actual behavior
Currently null checking is recognised in a statement `if (myVar !== null) { console.log(myVar.prop); }` but fails when assigned to a property:
```
const isVarSet = myVar !== null;
if (isVarSet) { console.log(myVar.prop); }
```
* Link to Try-Flow or Github repo:
[Flow try](https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoKBXAdgYwC4CWcWYA5gKZ4Cy5AzrQIYUAUAtnYxWALxhYYwYASjABvVAEgATpQxSS7ek3IBuVAF9U6bPiIkZDfAGE4rAA7FyWPAHUCeABZwMeAKJSpcKWw7KR4iRxiWjwwMxgGLBolLl4Kal8WRU5yITUwMFQMiWBgMCCsELACWmiUgEEANwYCCIAjGHIeMABCFvDIsuV0zOyZPDkSZjaOqMSmgDIJsAADAB5aM0iAPgASUVGuigA6QjxG9TngRZWZtI0tbVxCYjADY1MLLCs8HxjUsUkCos3x5vituQ3ilzhksmBAsFQiVAVUavVGs0RhExu8euDpLJ5GBmDDxnDagwGpNpvMTlg1hsUYDdvYDkdycszmp1EA)
I believe this issue is related too: https://github.com/facebook/flow/issues/7202
Contributor guide
Assessment
This issue has not been assessed yet.