Chapter 1. Getting familiar with TypeScript

 

This chapter covers

  • The benefits of programming in TypeScript over JavaScript
  • How to compile the TypeScript code into JavaScript
  • How to work with the Visual Studio Code editor

The goal of this chapter is to get you started with TypeScript development. We’ll start by paying respect to JavaScript, and then we’ll share our own opinion on why you should be programming in TypeScript. To round out this chapter, we’ll compile and run a very basic program so you can follow the workflow from writing a program in TypeScript to compiling it into runnable JavaScript.

If you’re a seasoned JavaScript developer you’d need a good reason to switch to TypeScript, which would have to be compiled into JavaScript before deployment anyway. If you’re a backend developer planning to learn the frontend ecosystem, you’d also need a reason for learning any programming language other than JavaScript, so let’s start with the reasoning.

1.1. Why program in TypeScript

TypeScript is a compile-to-JavaScript language, which was released as an open source project by Microsoft in 2012. A program written in TypeScript has to be transpiled into JavaScript first, and then it can be executed in the browser or a standalone JavaScript engine.

1.2. Typical TypeScript workflows

1.3. Using the Typescript compiler

1.4. Getting familiar with Visual Studio Code

Summary