TypeScript - how to install tsc (TypeScript compiller) for windows

16 points
Created by:

In this article we would liek to show how to install TypeScript compiler under Windows.

Quick solution:

npm install -g typescript

1. Instalation instruction

  1. Ensure that NodeJS and npm are installed (installation and running instruction is here).
  2. Open some terminal as administrator, e.g. Bash (installation struction is here).
  3. Install TypeScript compiller with command:
    npm install -g typescript
    where -g flag means global installation.
    john@DESKTOP-PC MINGW64 ~
    $ npm -g install typescript
    C:\Users\john\AppData\Roaming\npm\tsc -> C:\Users\john\AppData\Roaming\npm\node_modules\typescript\bin\tsc
    C:\Users\john\AppData\Roaming\npm\tsserver -> C:\Users\john\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
    + typescript@4.0.3
    updated 1 package in 17.571s

2. *.ts compilation instruction

  1. Create Script.ts file:
    for(let i = 0; i < 5; ++i)
        console.log('Hello world!');
  2. Run tsc command
    tsc Script.ts

    Note: after compliation Script.js file should be created.

  3. Run compiled program
    node Script.js


    Hello world!
    Hello world!
    Hello world!
    Hello world!
    Hello world!

3. References

  1.  TypeScript Installation - Microsoft Docs

Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.