Skip to content

Refine array types using filter #1414

@vkurchatkin

Description

@vkurchatkin

Not sure if it's possible, but it would be nice if flow could refine array type using filter:

function getArray(): Array<?{}> { [{}, {}, null, {}, null] }

const array: Array<{}> = getArray().filter(i => Boolean(i));

Simplest patterns that are already used to refine optional types would be just enough

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions