setup node js with typescript code example
Example 1: add typescript in node
npm init-y
yarn add -D @types/node typescript ts-node
npx tsconfig.json
"start": "ts-node src/index.ts",
console.log("Hello TypeScript");
yarn start
Example 2: install typescript in node project
npm i -D @types/node typescript ts-node
Example 3: start node typescript project
npx tsc --init --rootDir src --outDir build \
--esModuleInterop --resolveJsonModule --lib es6 \
--module commonjs --allowJs true --noImplicitAny true
Example 4: typescript tutorial nodejs
npm install express @types/express