In my typescript application, I have the config.json in the following format:
EventFilters": [
{
"Name": "AppLaunch",
"Version": "2"
},
{
"Name": "messageDisplayed",
"Version": "2"
},
{
"ID": "40021",
"Version": "2"
}
]
Now, in my .ts file, I want to read these key value pairs, and I am using the following code:
[![let eventfilters: Object\[\] = this.getEventFilters(); // this method reads the event filters from the config, as shown in the image
let keys: Object\[\];
for (let i: number = 0; i < eventfilters.length; i++) {
keys = Object.keys(eventfilters\[i\]);
for (let j: number = 0; j < keys.length; j++) {
if(eventfilters\[i\]\[keys\[j\]\] === \[/*Parameter 2 to compare*/\]){
//do something
}
}
}]
I am trying to compare the values in 'if' statement, using the following 'eventfilters[i][keys[j]]'. However, its throwing the following error 'Type 'Object' cannot be used as an index type.'.
However, when I use the following statement in the browser console, it returns me the value of the key, 'eventfilters[0][0]'
And due to the version of the typescript and ecmascript, I cannot use the following:
Object.values(eventfilters[i]); OR Object.entries(eventfilters[i]);
Apologies for the long question and thanks in advance.
