facebook / facebook/flow

Intersection fails if more specific type comes last, again

Open
#2,697 5 comments 0 reactions 0 assignees View on GitHub
Typing: unions/intersections
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

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

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.