Skip to content

Array.prototype.filter misses undefined in returning value #18760

Closed
@ezubarev

Description

@ezubarev

TypeScript Version: 2.4.0

Code

const values = [1, 2];
values.filter((value) => value === 3)[0];

Expected behavior:
Object is possibly 'undefined'.

Actual behavior:
No errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions