Intersection Types with Object Spread Behave Inconsistently
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
When creating an intersection of two types, and spreading the "rest props" of that object value, flow does not track the properties with in the spread object properly.
However, if I merge the two types that I was creating an intersection with, the behavior is correct. [The documentation](https://flow.org/en/docs/types/intersections/#toc-intersections-of-object-types) implies that an intersection type should provide the intended typing, so this may be a bug with `flow@0.54`?
[This try flow](https://flow.org/try/#0JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wChSYBPMJOANRQBsBXJAZzgF44BvUuOADcmrNgC44AQShQUlADwA7ZiABGSKAD4ANKQC+5KjTgAhdBEVde-OIpQgkE-KvOL8ug6QD0XuDAAWwBxs-hDMjAAmthDwGjhQ2nCqzPDA8BEQ7ACEpJjMihjAFnAA5kgwDCzsABQ8tvZIiQB0LWA4YBx6EmZoxQBk9CLsAJTWAJC9imwQjEhNjBAl1W0QHU3CVWzD+uQ+foEcGezRsTLQOXkFMEWWMf4aAOLllaK19Q7Nre2dEnUtTT0LJ8mi9jnpRnw4BMLNNZvNFstvushls4DtyBigA) demonstrates the issue.
EDIT: I should also note, this does not error on 0.53 or 0.53.1 and could be related to the `Made rest parameters in object destructuring patterns sealed, and exact if possible` update in 0.54?
Contributor guide
Assessment
This issue has not been assessed yet.