facebook / facebook/flow

Intersection fails if more specific type comes last, again

Ouverte
#2,697 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Typing: unions/intersections
Langage dominant
Rust
Étoiles
22.3k
Forks
1.9k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

This is kind of a dup of https://github.com/facebook/flow/issues/2074, except it's not. That issue says that in the code below FooBar type would behave as Foo, however it produces an error. The reason for the error is not clear since the value satisfies both types.

type Foo = {
type: string,
};

type Bar = {
type: 'specific',
};

type FooBar = Foo & Bar;

({type: 'specific'} : FooBar); // error

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.