---
title: "Learn TypeScript development in Visual Studio Code"
description: "Visual Studio Code makes coding easier, faster, and less frustrating."
url: https://sevalla.com/blog/typescript-visual-studio/
---

[Blog](https://sevalla.com/blog/)

# Learn TypeScript development in Visual Studio Code

Visual Studio Code makes coding easier, faster, and less frustrating.

Updated: Nov 30, 2026·by Antonello Zanini

Visual Studio Code is a code editor favored by many programmers who appreciate its wide range of features and its open source heritage. Visual Studio Code makes coding easier, faster, and less frustrating. That's especially true when it comes to [TypeScript](https://sevalla.com/blog/what-is-typescript/), which Visual Studio Code supports out of the box.

Features like code completion, parameter hints, and syntax highlighting go a long way toward making TypeScript developers more productive in Visual Studio Code. It also comes with a built-in Node.js debugger and can compile TypeScript to JavaScript from the editor. However, some of these features need to be configured for the best experience.

## How to configure Visual Studio Code for TypeScript development

This step-by-step tutorial shows how to set up Visual Studio Code for TypeScript development. We initialize a Node.js project in TypeScript, write some code, and then compile, run, and debug it, all in Visual Studio Code. Finally, we add ESLint to catch problems as you type. The steps were tested with TypeScript 7.0, Node.js 24, and ESLint 10.

### Prerequisites

Before getting started, make sure you have:

- [Node.js](https://nodejs.org/) installed. See our guide on [how to install Node.js](https://sevalla.com/blog/how-to-install-node-js/) if you need it.
- [Visual Studio Code](https://code.visualstudio.com/) downloaded and installed.

You need Node.js and npm, the Node.js package manager that comes with it, to build your TypeScript project. You can verify that Node.js is installed on your machine with the following terminal command:

```
node -v
```

That should return the version of Node.js on your machine, like this:

```
v24.20.0
```

Now let's get started with TypeScript in Visual Studio Code!

## Create a TypeScript project

Let's create a simple Node.js TypeScript project called **hello-world**. Open your terminal, and create a folder for your project:

```
mkdir hello-world
cd hello-world
```

Inside **hello-world**, initialize a project with the following npm command:

```
npm init -y
```

This creates a **package.json** config file for your Node.js project. Time to see what the project consists of in Visual Studio Code!

Launch Visual Studio Code and select **File** \> **Open Folder…**

In the window that pops up, select the **hello-world** project folder and click **Open**. Your project should look something like this:

![The Node.js project open in Visual Studio Code.](https://sevalla.com/images/blog/typescript-visual-studio/open-typescript-project-visual-studio-code.webp)

The Node.js project open in Visual Studio Code.

Currently, the project consists of only the **package.json** file initialized by `npm init`.

### Install the TypeScript compiler

Visual Studio Code supports TypeScript development, but it doesn't include the TypeScript compiler, `tsc`. The [TypeScript compiler](https://www.typescriptlang.org/docs/handbook/compiler-options.html) checks your code for type errors and transpiles it to JavaScript, which you can then run with Node.js or in a browser.

Select **View** \> **Terminal** in the Visual Studio Code menu to open the editor's [integrated terminal](https://code.visualstudio.com/docs/terminal/basics). There, install TypeScript and the type definitions for Node.js as development dependencies of your project:

```
npm install -D typescript @types/node
```

Installing TypeScript in the project, rather than globally, means everyone who works on the project uses the same version. You run it with `npx`. Verify the installed version:

```
npx tsc --version
```

You should see something like `Version 7.0.2`. TypeScript 7.0 is the native version of the compiler, written in Go, which is about 10 times faster than earlier versions. Learn more in our article on [what's new in TypeScript 7.0](https://sevalla.com/blog/typescript-7-0/).

### Configure the TypeScript compiler

Next, run this command in the terminal:

```
npx tsc --init
```

This creates a TypeScript configuration file named [**tsconfig.json**](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) in the project directory. It tells the compiler which files to compile, where to put the output, and how strictly to check your code.

Open **tsconfig.json** in Visual Studio Code. TypeScript 7.0 generates a short file with sensible defaults, such as `"strict": true` and `"sourceMap": true`, and comments that explain how to adjust it. Make these changes at the top of the file:

1. Uncomment the `rootDir` and `outDir` options, so the compiler reads your code from the **src** folder and writes the JavaScript to the **dist** folder:  
```  
"rootDir": "./src",  
"outDir": "./dist",  
```
2. Replace the line `"types": [],` with the options for Node.js, which are already in the file as comments:  
```  
"lib": ["esnext"],  
"types": ["node"],  
```

The top of your **tsconfig.json** file now looks like this:

```
{
  "compilerOptions": {
    // File Layout
    "rootDir": "./src",
    "outDir": "./dist",
 
    // Environment Settings
    "module": "nodenext",
    "target": "esnext",
    "lib": ["esnext"],
    "types": ["node"],
 
    // Other Outputs
    "sourceMap": true,
    ...
  }
}
```

Here's why these options matter:

- The [outDir](https://www.typescriptlang.org/tsconfig#outDir) option keeps the compiled files in a separate folder, instead of mixing them with your source code.
- The `types` option tells TypeScript which type definitions to load. Since TypeScript 6.0, it doesn't load the packages in **node\_modules/@types** automatically, so without `"node"` here, even `console.log()` fails with `Cannot find name 'console'`.
- The [sourceMap](https://www.typescriptlang.org/tsconfig#sourceMap) option, which is on by default, generates **.js.map** files that map the compiled JavaScript back to your TypeScript. The Visual Studio Code debugger uses them so that you can set breakpoints in your TypeScript files.

Your TypeScript project is almost ready to be compiled. But first, you need TypeScript code.

Right-click in the **Explorer** section, select **New Folder…**, and name it `src`. Then right-click the **src** folder, select **New File…**, type `index.ts`, and press **Enter**. Add the following code to **src/index.ts**:

```
const message: string = "Hello, World!";
console.log(message);
```

This snippet simply prints the well-known _Hello, World!_ message.

## Try IntelliSense for code completion

When you were writing the lines above in Visual Studio Code, you might have noticed some code suggestions made by the editor. This happens because of [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense), one of Visual Studio Code's most useful features.

IntelliSense includes features like code completion, documentation on hover, and parameter info for functions. It suggests how to complete the code as you type, which can significantly improve your productivity and accuracy. You can see it in action here:

![Visual Studio Code's IntelliSense code completion in action.](https://sevalla.com/images/blog/typescript-visual-studio/intellisense-visual-studio-code.gif)

Visual Studio Code's IntelliSense code completion in action.

Visual Studio Code comes with IntelliSense support for TypeScript out of the box, so you don't have to configure it. To use the faster TypeScript 7.0 language service in the editor, install the [TypeScript 7](https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.native-preview) extension from the TypeScript team, formerly called TypeScript Native Preview.

Now that you've written some TypeScript, let's compile it and see if it works.

## Compiling TypeScript in Visual Studio Code

Open the integrated terminal in Visual Studio Code and run:

```
npx tsc -p .
```

This compiles all TypeScript files in the project to JavaScript. The `-p .` option tells the compiler to use the **tsconfig.json** file in the current directory, which is also what `npx tsc` does by default. The output, including **index.js** and the source map **index.js.map**, is written to the **dist** folder.

You can confirm that the compiled JavaScript code works with this command in the terminal:

```
node dist/index.js
```

Node.js runs **index.js** and prints:

```
Hello, World!
```

Another way to start the compiler is to select **Terminal** \> **Run Build Task…** in the Visual Studio Code menu, and click the **tsc: build - tsconfig.json** option.

![Starting the build process from the Visual Studio Code menu.](https://sevalla.com/images/blog/typescript-visual-studio/transpiling-visual-studio-code.png)

Starting the build process from the Visual Studio Code menu.

This runs the same build as `tsc -p .`, directly from the editor. The **tsc: watch - tsconfig.json** option starts the compiler in watch mode, which recompiles your code every time you save a file.

Node.js 24 can also run TypeScript files directly by stripping the type annotations, so `node src/index.ts` prints the same message without a build step. It doesn't check types, though, so you still need `tsc` to catch type errors.

## Run and debug TypeScript in Visual Studio Code

Visual Studio Code supports TypeScript debugging with its built-in [Node.js debugger](https://code.visualstudio.com/docs/nodejs/nodejs-debugging). To set it up, click the **Run and Debug** icon on the sidebar, click **create a launch.json file**, and select **Node.js**.

![Selecting the Node.js debugger for the launch.json configuration.](https://sevalla.com/images/blog/typescript-visual-studio/node-debugger-visual-studio-code.webp)

Selecting the Node.js debugger for the launch.json configuration.

This creates a default **launch.json** file in the project's **.vscode** folder. It's the configuration file that the Visual Studio Code debugger uses to launch and debug an application: it specifies how to start the application, the arguments to use, and the environment variables to set.

Open that file and edit it as follows:

```
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}/src/index.ts",
      "preLaunchTask": "tsc: build - tsconfig.json",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"]
    }
  ]
}
```

Here's what the important options do:

- **`program`** is the entry point of the application to debug. For a TypeScript project, it's your main TypeScript file.
- **`preLaunchTask`** is the name of the Visual Studio Code task to run before launching the application. Here, it's the TypeScript build task, so the debugger always runs your latest code.
- **`outFiles`** tells the debugger where to find the compiled JavaScript files. The debugger runs them, and uses the source maps generated by `"sourceMap": true` to map them back to your TypeScript code, so you can debug the TypeScript directly.

Save the **launch.json** file and open **src/index.ts**. Click the blank space to the left of the line number of the `console.log()` line to set a breakpoint. A red dot appears next to the line:

![The red dot marks a debugging breakpoint.](https://sevalla.com/images/blog/typescript-visual-studio/debug-breakpoint-visual-studio-code.webp)

The red dot marks a debugging breakpoint.

When you run the code with the debugger, the execution stops there. This lets you check that the Node.js debugger in Visual Studio Code works as expected.

Go to the **Run and Debug** section again and click the green play button to start the debugger. Visual Studio Code runs the build task, then launches the program, and execution stops at the breakpoint.

![The Visual Studio Code debugger paused at the breakpoint.](https://sevalla.com/images/blog/typescript-visual-studio/debug-running-visual-studio-code.webp)

The Visual Studio Code debugger paused at the breakpoint.

On the left, you can see the values of the variables at the breakpoint. You can also pause, step over, step in and out, restart, and stop the program, as described in the Visual Studio Code [debugging documentation](https://code.visualstudio.com/docs/editor/debugging).

Press **F5** to resume the execution, and you should see the following message in the **Debug Console** tab:

```
Hello, World!
```

This is what you expect the application to produce, which means the program ran correctly.

You just learned how to set up Visual Studio Code for TypeScript programming. There's one more thing that makes writing quality TypeScript code easier: a linter.

## How to configure ESLint in Visual Studio Code

You can extend Visual Studio Code with [extensions](https://kinsta.com/blog/vscode-extensions/), which add features to the editor. One of the most popular extensions for TypeScript development is the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).

[ESLint](https://eslint.org/) is a static code analysis tool for JavaScript and TypeScript that helps you find and fix common problems, such as unused variables, and enforce consistent code. With [typescript-eslint](https://typescript-eslint.io/), it understands TypeScript code. The extension runs ESLint directly in the editor, so you see problems as you type.

Let's add ESLint to your TypeScript project.

### 1\. Install ESLint and typescript-eslint

typescript-eslint uses the TypeScript compiler's JavaScript API, which TypeScript 7.0 doesn't include yet, so it can't use TypeScript 7.0\. If you try to install it in a project with TypeScript 7.0, npm stops with an `ERESOLVE` error, because typescript-eslint requires a TypeScript version lower than 6.1.

Until a new API arrives, you can install TypeScript 6.0 and 7.0 side by side. This command installs TypeScript 6.0 under the `typescript` name, for tools like typescript-eslint, and TypeScript 7.0 under the `@typescript/native` name:

```
npm install -D "typescript@npm:@typescript/typescript6@^6.0.2" "@typescript/native@npm:typescript@^7.0.2"
```

With this setup, `npx tsc` still runs TypeScript 7.0, so your builds stay fast, and tools that import the `typescript` package get TypeScript 6.0.

Now install ESLint, its recommended JavaScript rules, and typescript-eslint:

```
npm install -D eslint @eslint/js typescript-eslint
```

### 2\. Create the ESLint configuration

Create a file named **eslint.config.mjs** in the project's root directory:

```
// @ts-check
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
 
export default defineConfig(
  { ignores: ['dist/'] },
  eslint.configs.recommended,
  tseslint.configs.recommended,
);
```

This is ESLint's flat config format, which replaces the old **.eslintrc.json** files. It ignores the compiled files in **dist**, and turns on ESLint's recommended rules and typescript-eslint's recommended rules for TypeScript.

You can also generate a configuration interactively with `npm init @eslint/config@latest`, which asks you a few questions and installs the packages you need.

To check that ESLint works, add a line with a few problems to **src/index.ts**:

```
let unused: any = 1;
```

Then run ESLint in the terminal:

```
npx eslint .
```

ESLint reports three problems:

```
src/index.ts
  2:5   error  'unused' is never reassigned. Use 'const' instead  prefer-const
  2:5   error  'unused' is assigned a value but never used        @typescript-eslint/no-unused-vars
  2:13  error  Unexpected any. Specify a different type           @typescript-eslint/no-explicit-any
 
✖ 3 problems (3 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
```

Remove the line before you continue.

### 3\. Install the ESLint extension

Now install the ESLint extension in Visual Studio Code. Click the **Extensions** icon in the sidebar and search for `ESLint`. Find the ESLint extension by Microsoft and click **Install**.

![Installing the ESLint extension in Visual Studio Code.](https://sevalla.com/images/blog/typescript-visual-studio/eslint-installation-visual-studio-code.webp)

Installing the ESLint extension in Visual Studio Code.

The extension finds your **eslint.config.mjs** file automatically, and underlines problems in your TypeScript files as you type.

To also fix the problems ESLint can fix automatically every time you save a file, create a **settings.json** file in the **.vscode** folder with the following content:

```
{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  }
}
```

The **settings.json** file in **.vscode** contains settings for this project, which override your global Visual Studio Code settings. The `"explicit"` value runs the fixes when you save a file manually, but not when Visual Studio Code saves it automatically.

Now, when you save **index.ts**, ESLint fixes problems like a `let` that should be a `const`, and highlights the ones you need to fix yourself. Nothing can stop you from writing quality code!

## Summary

Configuring Visual Studio Code for TypeScript development is fairly straightforward. You just learned how to create a Node.js project in TypeScript, load it in Visual Studio Code, and use the editor to write code with IntelliSense. You also configured the TypeScript compiler, set up the Node.js debugger to debug TypeScript code, and added ESLint to the project.

When your Node.js app is ready to go live, you can deploy it from Git with Sevalla's [Application Hosting](https://sevalla.com/application-hosting/), and add a managed database with [Database Hosting](https://sevalla.com/database-hosting/).

Share on:[Tweet](https://x.com/intent/post?text=I've just read this article "Learn TypeScript development in Visual Studio Code" on @sevalla%5Fhosting 's blog: https://sevalla.com/blog/typescript-visual-studio/ "x.com")[Reddit](https://www.reddit.com/submit?url=https://sevalla.com/blog/typescript-visual-studio&title=Learn TypeScript development in Visual Studio Code "Reddit")[HackerNews](https://news.ycombinator.com/submitlink?u=https://sevalla.com/blog/typescript-visual-studio&t=Learn TypeScript development in Visual Studio Code "HackerNews")

## Deep dive into the cloud!

Deploy your application, database, or static site in minutes.

[Get started](https://sevalla.com/signup/)
