Let’s take a look at several ways of how you could run a single Typescript file in the WebStorm IDE

What will be covered in this article:

  • The easiest way (without installing the npm package)
  • Launching file with the use of the script
  • Creating “Run Active” Configuration

Prerequisites

For running our Typescript files, we will be using the ts-node npm package. In some scenarios, you will not be needed to install the package locally

The easiest way

If you need to run one file and see the results, you don’t need to add ts-node to your dev dependencies.

Let’s take a look at the simple example: currently, we have a single .ts file in our project examples/User.ts .

Image for post

After running this command in your terminal…

npx ts-node examples/User.ts

#javascript #webstorm #typescript

How to Run and Debug A Single TypeScript File in The WebStorm IDE
1.75 GEEK