How to setup Node.js with Typescript within 1 minute

This is a 1 minute guide on how to setup Node.js with Typescript.

Profile Picture

Sivanesh Shanmugam

1 min read

How to setup Node.js with Typescript within 1 minute

This is a 1 minute guide on how to setup Node.js with Typescript.

Install Typescript and its dependencies.

npm install typescript ts-node @types/node @types/express --save-dev

# or

yarn add typescript ts-node @types/node @types/express -D

Create a tsconfig.json for your Typescript.

npx tsc --init

Then write your first lines of code in any file (I'm using app.ts)

Then run the application using the below script

npx ts-node app.ts

This will also supports import and export modules directly as it uses tsc

MailLinkedInGitHubTwitter