facebook / facebook/flow

Intersection type incompatible with equivalent type

オープン
#3,363 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
22.3k
フォーク
1.9k
PR マージ指標
30日以内にマージされた PR はありません

説明

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)?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。