Install and Configure

To install and configure TypeScript in your project, you need to perform the following steps:

npm init
npm install --save-dev typescript
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "outDir": "./dist",
    "rootDir": "./src"
  "exclude": ["node_modules"]
npx tsc

Note: You can also compile individual TypeScript files by specifying the file path after the tsc command. For example:

npx tsc ./src/index.ts

And you’re all set! You can now start writing TypeScript code in your project.

Learn more from the following links: