Type refinement breaks on simple, exact object types
Aperta
Typing: refinements
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I just discovered exact-typed objects in the docs, but refinement doesn't seem to be working correctly:
```js
type S = {| |};
type L = {|
k: string
|};
declare var x: S | L;
if (x.k === undefined) {
// S|L ↦ S
(x: L); //ng
(x: S);
(x: S | L);
} else {
// S|L ↦ L
(x: L); //Flow mistakenly calls this an error
(x: S); //ng
(x: S | L);
}
if (x.k !== undefined) {
// S|L ↦ L
(x: L); //Flow mistakenly calls this an error
(x: S); //ng
(x: S | L);
} else {
// S|L ↦ S
(x: L); //ng
(x: S);
(x: S | L);
}
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.