i'm trying to get an array of all the keys in an object with nested properties, my code:
public static getKeys(obj: Object) {
let keys: string[] = [];
for (let k in obj) {
if (typeof obj[k] == "Object" && obj[k] !== null) {
keys.push(obj[k]);
CHelpers.getKeys(<Object>obj[k]);
} else {
return keys;
}
}
}
However, obj[k] is giving me the error "Element implicitly has an 'any' type because type 'Object' has no index signature". i've looked at some other threads with the same error but it seems like their situations are different
i tried the function in playground but it doesn't have this problem there. But in Webstorm and it's giving this error; what could be causing it?