What this book covers

Chapter 1, TypeScript Tools and Framework Options, sets the scene for beginning TypeScript development. It discusses the benefits of using TypeScript as a language and compiler, and then works through setting up a complete development environment using a number of popular IDEs.

Chapter 2, Types, Variables, and Function Techniques, introduces the reader to the TypeScript language, starting with basic types and type annotations, and then moves on to discuss variables, functions, and advanced language features.

Chapter 3, Interfaces, Classes, and Inheritance, builds on the work from the previous chapter, and introduces the object-oriented concepts and capabilities of interfaces, classes, and inheritance. It then shows these concepts at work through the Factory Design Pattern.

Chapter 4, Decorators, Generics, and Asynchronous Features, discusses the more advanced language features of decorators and generics, before working through the concepts of asynchronous programming. It shows how the TypeScript language supports these asynchronous features through promises and the use of async await constructs.

Chapter 5, Declaration Files and Strict Compiler Options, walks the reader through building a declaration file for an existing body of JavaScript code, and then lists some of the most common syntax used when writing declaration files, as a cheat sheet. It then discusses the strict compiler settings that are available for the compiler—where they should be used, and what benefits they bring.

Chapter 6, Third-Party Libraries, shows the reader how to use declaration files from the DefinitelyTyped repository within the development environment. It then moves on to show how to write TypeScript code that is compatible with three popular JavaScript frameworks—Backbone, AngularJS (version 1), and ExtJS.

Chapter 7, TypeScript Compatible Frameworks, takes a look at popular frameworks that have full TypeScript language integration. It explores the MVC paradigm, and then compares how this design pattern is implemented in Backbone, Aurelia, Angular 2, and React. A sample program that uses form-based input is implemented in each of these frameworks.

Chapter 8, Test-Driven Development, starts with a discussion on what test-driven development is, and then guides the reader through the process of creating various types of unit tests. Using the Jasmine library, it shows how to use data-driven tests, and how to test asynchronous logic. The chapter finishes with a discussion on test runners, test reporting, and using continuous integration build servers.

Chapter 9, Testing TypeScript Compatible Frameworks, shows how to test the sample application built with each of the TypeScript compatible frameworks. It breaks down the testing strategy into Model tests, View tests, and Controller tests, and shows the differences between the testing strategies of these frameworks.

Chapter 10Modularization, explores what modules are, how they can be used, and the two types of module generation that the TypeScript compiler supports: CommonJS and AMD. It then shows how modules can be used with module loaders, including Require and SystemJS. This chapter then takes an in-depth look at using modules within Node in order to build a sample Express application. Finally, it discusses the use of modules in a serverless environment using AWS Lambda functions.

Chapter 11Object-Oriented Programming, discusses the concepts of object-oriented programming, and then shows how to arrange application components to conform to object-oriented principles. It then takes an in-depth look at implementing object-oriented best practices by showing how the State and Mediator design patterns can be used to manage complex UI interactions.

Chapter 12Dependency Injection, discusses the concepts of service location and dependency injection, and how they can be used to solve common application design problems. It then shows how to implement a simple dependency injection framework using decorators.

Chapter 13Building Applications, explores the fundamental building blocks of web application development, showing how to integrate an Express server and an Angular site. It then explores the all important authorization mechanisms that any site must have in place, with an in-depth discussion of JWT tokens. Finally, this chapter shows how to integrate social medial logins, such as Google or Facebook, into a site.

Chapter 14, Let's Get Our Hands Dirty, builds a single-page application using Angular and Express by combining all of the concepts and components built throughout the book into a single application. These concepts include test-driven development, the State and Mediator pattern, designing and using Express REST endpoints, object-oriented design principles, and modularization. This chapter also explores common techniques when using observables to handle most types of REST API interaction.