google / google/closure-compiler
Unknown type when accessing string in array-like fashion
Open
bug
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
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).
Contributor guide
Assessment
This issue has not been assessed yet.