All You Need to Know About Typescript

Tuesday, Apr 15, 2025

1 min read

Aysham Ali

cover

Setup

  1. Setting up project
    npm init -y

  2. Install typescript globally using npm
    npm i -g typescript

  3. Verify by
    tsc --version

  4. Create a typescript config file
    tsc --init --sourceMap --rootDir src --outDir dist

  5. Create src folder with ts file
    console.log(“hello”)

  6. Create a launch.json file in vscode
    change src and ts to dist and js

  7. Add a watcher

    1. Install typescript as dev dependency (locally)
      npm i --save-dev typescript
  8. Create a Run Task for TS to watch

  9. Create a Build Task for TS to build

  10. Click run button to run code