Skip to content

Flow can't seem to choose between union types #5873

@ghost

Description

try flow

declare function gen(): [Error, null] | [null, number];

const [err, number] = gen();

if (!err) {
  (number: number)
}

that last cast throws an error that number can be null even though the if statement should force (err: null) and (number: number)

Any suggestions on how to re-write this would be appreciated!

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