Intersection type incompatible with equivalent type
Aperta
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
In this example:
```
type A = { type: 'a', a: string }
type B = { type: 'b', b: string }
type C = { type: 'a' } & ( A | B )
const a : A = { type: 'a', a: 'a' }
const c : C = { type: 'a', a: 'a' }
const a1 : A = c // (c) intersection. This type is incompatible with (A) object type
const c1 : C = a // fine
```
I believe `C` and `A` should be equivalent (though I might be missing something), but flow is showing an error when assigning a value of type `C` to a variable of type `A`.
Would it be possible for flow deduce that `A` and `C` are equivalent in this case (if they are)?
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.