Languages
[Edit]
EN

TypeScript - how to install tsc (TypeScript compiler) for Windows

16 points
Created by:
Imaan-Morin
619

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.
    Output:
    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

    Output:

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

3. References

  1.  TypeScript Installation - Microsoft Docs

TypeScript

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join