I'm trying to check whether an array index exist in TypeScript, by the following way (Just for example):
var someArray = [];
// Fill the array with data
if ("index" in someArray) {
// Do something
}
However, i'm getting the following compilation error:
The in operator requires the left operand to be of type Any or the String primitive type, and the right operand to be of type Any or an object type
Anybody knows why is that? as far as I know, what I'm trying to do is completely legal by JS.
Thanks.