Skip to content

Unknown type when accessing string in array-like fashion #3538

Open
@an3ss

Description

@an3ss

The following code produces no warning despite the type mismatch on the second line:

var c = "abc"[1];
var /**number*/ n = c;  // no warning

It looks like getting a character from a string in this way produces a value of unknown type (I have confirmed this by turning reportUnknownTypes on).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions