Reputation: 39
enter image description herestrong text
Consider using '--resolveJsonModule' to import module with '.json' extension
Upvotes: 1
Views: 4686
Reputation: 1920
Copy this in your tsconfig.json file , inside compilerOptions
:
"resolveJsonModule": true,
"esModuleInterop": true
Upvotes: 0
Reputation: 56
Try to solve it this way. Its work for me.
Create file called json-typings.d.ts
in src/app
folder.
and typing file as follows:
declare module "*.json" {
const value: any;
export default value;
}
Then you can import Json files just like TypeScript 2.9+.
import * as info from "info.json";
Upvotes: 3
Reputation: 150
open File tsconfig.json
and change resolveJsonModule : to true.
{
resolveJsonModule:true,
}
Upvotes: 5
Reputation: 1458
Please add in your tslint.json file
{
"linterOptions": {
"exclude": [
"*.json",
"**/*.json"
]
}
}
**/*.json to be recursive
Upvotes: 1