'Typescript: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher

Whenever I try to loop through a JSON file, I get Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.
I have tried this solution error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher but it I get this errr after doing tsc --target es6 forOf.ts: error TS6053: File 'forOf.ts not found. The file is in the program because: Root file specified for compilation

What do I have to do?



Solution 1:[1]

Go to your tsconfig.json In that change target: es6

And run tsc in your cmd/terminal in root directory

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bishwajit jha