Example 1: typescript config
{
"compilerOptions": {
"outDir": "dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"esModuleInterop": true,
"downlevelIteration": true,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"skipLibCheck": true,
"sourceMap": true,
"removeComments": true,
"noEmitOnError": true,
"strict": false,
"alwaysStrict": false,
"noImplicitAny": false,
"typeRoots": ["node_modules/@types/"]
},
"include": ["server.ts", "src/**/*.ts", "knexfile.ts"],
"exclude": ["node_modules", "dist", "__tests__"]
}
{
"name": "express-payment-gateway",
"version": "1.0.0",
"description": "express payment gateway",
"main": "dist/server.js",
"scripts": {
"cleanup": "rimraf dist",
"compiler": "tsc --pretty",
"compiler:watch": "tsc --watch",
"build": "npm run cleanup && npm run compiler",
"start": "node dist/server.js",
"dev": "nodemon -w *.ts -e ts -x ts-node --files -H -T server.ts"
},
"repository": {
"type": "git",
"url": "restuwahyu13"
},
"keywords": [
"wabot",
"whatsapp"
],
"author": "restuwahyu13",
"license": "MIT",
"dependencies": {
"@sendgrid/mail": "^7.4.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-rate-limit": "^5.2.3",
"express-slow-down": "^1.4.0",
"express-validator": "^6.9.2",
"helmet": "^4.2.0",
"js-base64": "^3.6.0",
"jsonwebtoken": "^8.5.1",
"knex": "^0.21.15",
"moment": "^2.29.1",
"multer": "^1.4.2",
"pg": "^8.5.1",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/body-parser": "^1.19.0",
"@types/compression": "^1.7.0",
"@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.9",
"@types/eslint": "^7.2.6",
"@types/express": "^4.17.9",
"@types/express-rate-limit": "^5.1.0",
"@types/express-slow-down": "^1.3.0",
"@types/express-validator": "^3.0.0",
"@types/helmet": "^4.0.0",
"@types/http-errors": "^1.8.0",
"@types/js-base64": "^3.0.0",
"@types/jsonwebtoken": "^8.5.0",
"@types/knex": "^0.16.1",
"@types/moment": "^2.13.0",
"@types/morgan": "^1.9.2",
"@types/multer": "^1.4.5",
"@types/node": "^14.14.16",
"@types/pg": "^7.14.7",
"@types/request": "^2.48.5",
"@types/sendgrid": "^4.3.0",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.1",
"babel-eslint": "^10.1.0",
"dotenv": "^8.2.0",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.0",
"eslint-plugin-promise": "^4.2.1",
"husky": "^4.3.6",
"morgan": "^1.10.0",
"nodemon": "^2.0.6",
"npm": "^7.3.0",
"prettier": "2.2.1",
"rimraf": "^3.0.2",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
}
}
Example 2: typescript -g doesnst read tsconfog
root/
- tsconfig.json
- index.ts
tsc index.ts
tsc