Skip to content

Tuple allows access at any index #10965

@OliverJAsh

Description

@OliverJAsh

Version: 2 rc

Given:

    const cell: [ number, number ] = [ 0, 1 ];
    const y = cell[100]
    y

I expect cell[100] to error, but it doesn't. y has a type of number. This means it's very easy to me to have bugs whereby I'm asking for an index that doesn't exist (like asking for a property that doesn't exist on an object).

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