If you have read the previous chapter of the TypeScript Tutorial series, you have already learned how to install Node.js and TypeScript and might have already installed those. Now, it's time to go a step further to learn how to write code in TpeScript.
In this article, we will learn how to create a simple
HelloWorld application, compile it and run it. Continue reading to know more.
You can use Notepad or any other text editor to write TypeScript code. Here, in this series of TypeScript Tutorial, we will be using Visual Studio Code editor to demonstrate each one of the code snippets. You can download Visual Studio code directly from Microsoft site. Here is the link: https://code.visualstudio.com/Download.
Once downloaded, double-click on the installer file and follow the step-by-step instructions to install the Visual Studio Code in your system. Make sure that you have successfully installed the Node.js and TypeScript in your development environment.
How To Do It...
Open the Visual Studio Code editor and follow the simple mentioned steps in order to create your first TypeScript application which will print a message in the console output:
How It Works
When you compile a TypeScript file (.ts) using the
console.log(...) method is used here to write some
strings in the output window. We will discuss all about this in the later parts of the TypeScript Tutorial.
👉 TypeScript Tutorial - Getting started with TypeScript