Book Image

Learning TypeScript 2.x - Second Edition

By : Remo H. Jansen
Book Image

Learning TypeScript 2.x - Second Edition

By: Remo H. Jansen

Overview of this book

TypeScript is an open source and cross-platform statically typed superset of JavaScript that compiles to plain JavaScript and runs in any browser or host. This book is a step-by-step guide that will take you through the use and benefits of TypeScript with the help of practical examples. You will start off by understanding the basics as well as the new features of TypeScript 2.x. Then, you will learn how to work with functions and asynchronous programming APIs. You will continue by learning how to resolve runtime issues and how to implement TypeScript applications using the Object-oriented programming (OOP) and functional programming (FP) paradigms. Later, you will automate your development workflow with the help of tools such as Webpack. Towards the end of this book, you will delve into some real-world scenarios by implementing some full-stack TypeScript applications with Node.js, React and Angular as well as how to optimize and test them. Finally, you will be introduced to the internal APIs of the TypeScript compiler, and you will learn how to create custom code analysis tools.
Table of Contents (17 chapters)

What this book covers

Chapter 1, Introducing TypeScript, helps you to get familiar with the TypeScript basics. This chapter explores the purpose, main features, and benefits of the TypeScript programming language.

Chapter 2, Working with Types, teaches you how to make the most out of the TypeScript type annotations and its type inference system. This chapter will teach you how to use powerful features, such as union types or mapped types.

Chapter 3, Working with Functions, covers how to work with functions in depth. This chapter will teach you how to take advantage of the power of functions and asynchronous programming in TypeScript.

Chapter 4, Object-Oriented Programming with TypeScript, deals with the core concepts of the object-oriented programming (OOP) paradigm, such as polymorphism, inheritance, and encapsulation. This chapter also explores some OOP best practices, such as the SOLID principles.

Chapter 5, Working with Dependencies, explores how to work with application dependencies, third-party dependencies, and type definitions. This chapter explores multiple module systems, such as CommonJS and ES6 modules, and concepts such as dependency injection.

Chapter 6, Understanding the Runtime, teaches you how the JavaScript runtime works and helps you gain a good understanding of concepts such as the event loop, closures, and hoisting.

Chapter 7, Functional Programming with TypeScript, explores the core building blocks of the functional programming paradigm, including concepts such as function composition, function partial application, and referential transparency.

Chapter 8, Working with Decorators, showcases how to apply and declare decorators and how to use decorators to create and read metadata that can be used to power tools such as testing frameworks and inversion of control containers.

Chapter 9, Automating Your Development Workflow, focuses on how to automate certain tasks in your development workflow and reduce the number of integration issues, using tools, such as TSLint, webpack, Gulp and npm scripts.

Chapter 10, Node.js Development with TypeScript, teaches you how to use REST APIs powered by Node.js and TypeScript.

Chapter 11, Frontend Development with React and TypeScript, enables you to learn how to develop single-page web applications powered by React and TypeScript.

Chapter 12, Frontend Development with Angular and TypeScript, teaches you how to develop single-page web applications powered by Angular and TypeScript.

Chapter 13, Application Performance, makes you understand how the availability of system resources can affect the performance of a TypeScript application, and how to use the Node.js inspector and the Chrome Development tools to analyze the performance of a TypeScript application.

Chapter 14, Application Testing, teaches you how to implement automated tests such as unit tests or end-to-end tests powered by tools such as Mocha, Chai, Sinon.JS, Supertest, and Karma.

Chapter 15, Working with the TypeScript Compiler and the Language Services, explores how to leverage the TypeScript language services to create your own code analysis tools.