tsconfig import json code example
Example 1: Cannot find module './data.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
add to tsconfig.json
{
...
"resolveJsonModule": true
}
}
Example 2: tsconfig.json not generated
$ tsc --init
Example 3: how to import a json string from a file in typescript
import {default as a} from "a.json";
a.primaryMain
Example 4: tsconfig.json basic configuration
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "public/js"
"rootDir": "src",
"strict": true,
"esModuleInterop": true
"forceConsistentCasingInFileNames": true
},
"include": ["src"]
}