Book Image

Mastering TypeScript - Fourth Edition

By : Nathan Rozentals
4.5 (2)
Book Image

Mastering TypeScript - Fourth Edition

4.5 (2)
By: Nathan Rozentals

Overview of this book

TypeScript is both a language and a set of tools to generate JavaScript, designed by Anders Hejlsberg at Microsoft to help developers write enterprise-scale JavaScript. Mastering Typescript is a golden standard for budding and experienced developers. With a structured approach that will get you up and running with Typescript quickly, this book will introduce core concepts, then build on them to help you understand (and apply) the more advanced language features. You’ll learn by doing while acquiring the best programming practices along the way. This fourth edition also covers a variety of modern JavaScript and TypeScript frameworks, comparing their strengths and weaknesses. You'll explore Angular, React, Vue, RxJs, Express, NodeJS, and others. You'll get up to speed with unit and integration testing, data transformation, serverless technologies, and asynchronous programming. Next, you’ll learn how to integrate with existing JavaScript libraries, control your compiler options, and use decorators and generics. By the end of the book, you will have built a comprehensive set of web applications, having integrated them into a single cohesive website using micro front-end techniques. This book is about learning the language, understanding when to apply its features, and selecting the framework that fits your real-world project perfectly.
Table of Contents (19 chapters)
Other Books You May Enjoy

To get the most out of this book

  • You will need the TypeScript compiler and an editor of some sort. The TypeScript compiler is available on Windows, MacOS, and Linux as a Node plugin. Chapter 1, Up and Running Quickly, describes the setup of a development environment
  • This book has been designed in a "type as you read" format. The code snippets are small, so feel free to type out the code yourself, as the text progresses, and learn by building up your code base and knowledge as you go.

Download the example code files

The code bundle for the book is hosted on GitHub at We also have other code bundles from our rich catalog of books and videos available at Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: "We can configure webpack using the webpack.config.js file."

A block of code is set as follows:

class MyClass {
    add(x: number, y: number) {
      return x + y;

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are highlighted:

const modulus: Observable<number> = emitter.pipe(
    map((value: number) => {
        console.log(`received : ${value}`);
        return value % 2;

Any command-line input or output is written as follows:

npm install @types/express

Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "Select Run from the Debug panel."

Warnings or important notes appear like this.