typescript compile code example

Example 1: typescript how to mode json files when compile

{
  "compilerOptions": {
     "resolveJsonModule": true,
   },
   "include": [
     "*/src/**/package.json"
  ]
}

Example 2: how to run typescript file

npx ts-node src/foo.ts

Example 3: how to allow implicit any in .d.ts

{
    "compilerOptions": {
        "skipLibCheck": true,
        ...
    },
    ...
}

Example 4: how to compile ts in cmd

"scripts": {
    "clean": "rimraf dist",
    "start": "npm-run-all clean --parallel watch:build watch:server --print-label",
    "watch:build": "tsc --watch",
    "watch:server": "nodemon './dist/index.js' --watch './dist'"
}