Skip to content

StrictNull check Tuple overflow #18253

Closed
Closed
@sebdoucet

Description

@sebdoucet

TypeScript Version: 2.4.1

Code

const tuple: [string, number] = ["", 0];
const value = tuple[2];

Expected behavior:
Not compiling. You cant define a type based on what is currently define in the array.
This behavior broke the strict null check validation because this value should be undefined or the accessor non legit.

Actual behavior:
Compile and value as the type of all types defined in the tuple, in this case string | number.

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