create node js typescript project code example
Example 1: add typescript in node
// Follow the below steps and you good to go easily
// create a new folder and open a terminal on that folder and type below commands
npm init-y
yarn add -D @types/node typescript ts-node
npx tsconfig.json
// open package.json and add in scripts
"start": "ts-node src/index.ts",
// create new folder src/index.ts ..... open - index.ts
console.log("Hello TypeScript");
//// And type below cmd for start....
yarn start
//// DONE!!!!!!!
Example 2: create typescript project
npx tsc index.ts
Example 3: start node typescript project
// create the tsConfig.json file
npx tsc --init --rootDir src --outDir build \
--esModuleInterop --resolveJsonModule --lib es6 \
--module commonjs --allowJs true --noImplicitAny true