Skip to content

Intersection fails if more specific type comes last, again #2697

@muntyan

Description

@muntyan

This is kind of a dup of #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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions