Typescript element implicitly has type any with for…in loops
问题 I have a JSON object imported from a JSON file (with resolveJsonModule: true ). The object looks like this: "myobject": { "prop1": "foo", "prop2": "bar" } and it's type therefore looks like this: myobject: { prop1: string, prop2: string } That's very nice but when I try to use a for...in loop, for (const key in myobject) { console.log(myobject[key]) } I get this error: TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ "prop1":