Quick setup

  1. Download and install Node.js.
  2. Open the terminal and install TypeScript globally:
    npm install -g typescript
  3. Create a JavaScript file and add some content; let’s call it index.ts:
    console.log("Hello world!");
  4. Transpile your file into a JavaScript file:
    tsc index.ts
  5. Verify that a index.js file was created at the side of the index.ts file.
  6. Run your new JavaScript file with Node:
    node index.js

Bonus

You can use the tsc index.ts --watch command to continuously monitor your TypeScript file for changes and transpile it to JavaScript every time your .ts file is saved.