Initialize a Typescript project
Initializing a Typescript project is quite easy, it's about creating a folder and launching init invocations
mkdir mihamina-typescript-project cd mihamina-typescript-project /home/mihamina/Apps/node/bin/npm init -y /home/mihamina/Apps/node/bin/npm install --save-dev typescript @types/node ts-node ts-node-dev /home/mihamina/Apps/node/bin/npx tsc --initThen I need to add an option in "tsconfig.json" in order to make the resulting Javascript is generated in a directory that I want
// in tsconfig.json { "compilerOptions": { // ... "outDir": "./dist", // ... } }And last, in "package.json", I need to have my usual build and start commands
{ // ... "scripts": { "build": "/home/mihamina/Apps/node/bin/npx tsc", "start": "/home/mihamina/Apps/node/bin/npx tsc && /home/mihamina/Apps/node/bin/node dist/index.js" }, // ... }