28.1. Why TypeScript?

The final chapters of the first unit cover a framework called Angular. Angular runs on TypeScript for a couple of reasons.

First, TypeScript is a superset of JavaScript. This means that you can write JavaScript code and use it in TypeScript files.

Second, TypeScript is a statically typed language. A statically typed language is a language where the type of a variable is given at the time the program is compiled. This is often achieved by adding the type of the variable to the variable declaration. However, this is not what we have been doing so far. JavaScript is a dynamically typed language. In a dynamically typed language, the type of the variable is determined at runtime and is based on the value inside the variable, not the variable declaration.

Statically typed languages are considered by many to be more stable and less prone to production errors, because the errors will occur in development.

28.1.1. Set Up Your Local Development Environment

As we continue to shift away from online work in repl.it to local development on your computer, you need to install some specific software.

  1. If you have not already done so, download and install Visual Studio Code on your machine.

  2. Install Node on your computer, which also installs the NPM Command Line Interface (CLI). We discussed this briefly in the Modules chapter.

The NPM CLI tool provides you with an efficient and deliberate way to install other software and modules onto your computer. As you proceed through the next four chapters, you will use the NPM CLI in the terminal to perform these installations.