facebook / facebook/flow

Intersection of union type cannot be assigned to that union type

Open
#3,376 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

[Reproducible Code Snippet](https://flowtype.org/try/#0C4TwDgpgBAglC8UDeUCGAuKBnYAnAlgHYDmUAvgFCiRQBCCyUARpjgSeVeNAMIMoBjVniKlK1aDHqI4AHzpcaMAB7TYUAGQKJsWsr4z6WnhQoAzAK6EBwfAHtCUYBBwBGABQZYAGjQtdvqjK-iq0gUzKQrr6AJTIFFBoDEFMCX7JEQIUZEA):

```javascript
type A = { a: string }
type B = { b: string }
type C = { c: string }
type AB = A | B
type AxB = A & B
type ABxC = AB & C

function test1(a: A, ab: AB, axb: AxB, abxc: ABxC) {
a = axb
ab = abxc // error
}
```

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.