delete check has misleading error message
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Flow version: 0.109.0
## Expected behavior
Error message should tell that `c` is a required property
## Actual behavior
Error message claims that `c` is missing from an object type
Following code:
```
type O1 = {a: number};
type O2 = O1 & {c:number};
declare var o: O2;
delete o.c;
```
Gives following error:
```
4: delete o.c;
^ Cannot delete `o.c` because property `c` is missing in `O1` [1].
References:
2: type O2 = O1 & {c:number};
^ [1]
```
If you change property `c` to optional:
`type O2 = O1 & {c:number};`
The error disappears. It's good that there is error, but the message is quite wrong. It should assist to make `c` optional, but instead it tells that O1 does not have the property at all.
* Link to Try-Flow or Github repo:
https://flow.org/try/#0C4TwDgpgBA8gjFAvFA3gQwFxQHYFcC2ARhAE4C+A3AFCiSwBMSsCAZKgMYZ5GmVUAmEdgBs0JaADcxUAPZYY9aoOERg0GQDp2FIA
Contributor guide
Assessment
This issue has not been assessed yet.