1npm i express cors dotenv && npm i -D typescript tsc ts-node-dev @types/express @types/node @types/cors
2
3//2)building tsconfig.json
4tsc --init
5
6//3) inside tsconfig.json
7{
8 "compilerOptions": {
9 "target": "es6",
10 "module": "CommonJS",
11 "outDir": "./dist",
12 "rootDir": "./",
13 "strict": true,
14 "noImplicitAny": false,
15 }
16}
17
18//4) package.json
19 "scripts": {
20 "dev": "ts-node-dev --clear server.ts",
21 "build": "tsc",
22 "start": "node dist/server.js"
23 },
24
25
26
1// it can vary a lot, but this is a beggining
2
3{
4 "compilerOptions": {
5 "target": "es5",
6 "module": "commonjs",
7 "outDir": "./dist",
8 "strict": true,
9 "noUnusedLocals": true,
10 "noUnusedParameters": true,
11 "noImplicitReturns": true,
12 "noFallthroughCasesInSwitch": true,
13 "esModuleInterop": true
14},
15 "include": ["src/**/*"],
16 "exclude": ["node_modules", "**/*.test.ts"]
17}
1try this config for nodejs + typescript using babel
2
3https://pastebin.com/TR4BXPqL