Answers for "tsconfig import json"

5

Cannot find module './data.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

add to tsconfig.json

{
	...
    "resolveJsonModule": true
  }
}
Posted by: Guest on July-30-2020
5

tsconfig.json not generated

$ tsc --init
Posted by: Guest on January-12-2020
1

tsconfig configuration

{
  "compilerOptions": {
    "target": "ES2015",
    "module": "commonjs",
    "lib": [ "ES2015", "dom" ],
    "sourceMap": true,
    "outDir": "./script", 
    "strict": true, 
    "strictNullChecks": true, 
    "strictFunctionTypes": true, 
    "noImplicitThis": true, 
    "alwaysStrict": true, 
    "noImplicitReturns": true, 
    "noFallthroughCasesInSwitch": true,
    "esModuleInterop": true,
    "experimentalDecorators": true, 
  }
}
Posted by: Guest on May-25-2021
1

tsconfig.json basic configuration

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "outDir": "public/js"
        "rootDir": "src",
        "strict": true,
        "esModuleInterop": true
        "forceConsistentCasingInFileNames": true
    },
    "include": ["src"]
}
Posted by: Guest on May-25-2021
-2

how to import a json string from a file in typescript

import {default as a} from "a.json";
a.primaryMain
Posted by: Guest on June-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language