Skip to content
This repository was archived by the owner on Nov 9, 2019. It is now read-only.
This repository was archived by the owner on Nov 9, 2019. It is now read-only.

Intersection of unions #11

@agentcooper

Description

@agentcooper
type Base = { name: string }

type Alternative =
    { type: 'A', value: string } |
    { type: 'B', value: number };

type Final = Alternative & Base;

const arr: Final[] = [
  { type: 'A', value: '1', name: 'c' }
];

const first: Final = arr[0]

Typescript 2.3 correctly shows no errors.

Flow 0.47.0 shows an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions