In a nodej project open in VsCode with checkJs enabled, when a json file is required like
const myFile = require('./my-file.json')
This makes an error [ts] Cannot find module.
How is it possible to remove the error warning?
I tried to:
add
"resolveJsonModule": trueto thecompilerOptionsinjsconfig.json, but it does not work.create a
typing.d.tsfile with this content:declare module '*.json' { const value: any; export default value; }But now, there is an error[ts] Type 'typeof import("*.json")' must have a '[Symbol.iterator]()' method that returns an iterator. [2488]