Installing TypeScript for Visual Studio Code

1 Comment

Visual Studio Code has support for the TypeScript language. To use it, create a new file with TypeScript code in Visual Studio Code:

And save the file, we will see TypeScript as an option:

We can see Visual Studio Code has TypeScript Intellisense:

Visual Studio Code does not include the TypeScript Compiler (tsc). To install it using the Visual Studio Code terminal, type:

npm install -g typescript

You will see TypeScript install:

You can now see which version of TypeScript is installed by entering tsc –version:

Now, create a new file:

Name the file tsconfig.json and add the code:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true
    }
}

Now, from the Tasks build menu, select Run Build Task:

And select tsc: build – tsconfig.json:

The terminal will execute the TypeScript compiler tsc:

Which will compile and produce JS files based on the TS files:

You can also simply type the tsc command to transpile the ts file directly.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

One Response to Installing TypeScript for Visual Studio Code

  1. Great article on setting up TypeScript in Visual Studio Code! The step-by-step guide and screenshots make it easy to follow. Installing TypeScript with npm and configuring tsconfig.json is made clear. Thanks for sharing this helpful tutorial!

Leave a Reply

Your email address will not be published. Required fields are marked *