Typescript Setup (NodeJS)
| Oliver Rademaker
NODEJS TYPESCRIPT CODE
- Install Nodejs (npm)
- Init Project
npm init - Install Typescript and TSlint into the project
npm install --save-dev --save-exact typescript tslint - Init
tsconfig.jsonand configurenpx tsc --init{ "compilerOptions": { "target": "ES6", "lib": ["ES6"], "experimentalDecorators": true, "emitDecoratorMetadata": true, "module": "commonjs", "rootDir": "src", "baseUrl": "./", "paths": { "*": [ "node_modules/*", "src/_types/*" ] }, }, "resolveJsonModule": true, "sourceMap": true, "outDir": "dist", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules", "**/*.spec.ts" ] } - Init
tslint.jsonand configurenpx tslint --init{ "defaultSeverity": "error", "extends": ["tslint:recommended"], "jsRules": {}, "rules": { "no-console": false }, "rulesDirectory": [], "include": ["src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"] } - Update
package.json{ "scripts": { "start": "tsc && node dist/app.js" }, }