文件名称:Mastering TypeScript-Second Edition[February 2017]
文件大小:6.29MB
文件格式:PDF
更新时间:2021-06-07 02:52:04
TypeScript
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, Writing and Using Declaration Files, 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. This syntax is designed to be a quick reference guide to the declaration file syntax, or a cheat sheet. 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, Angular 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. 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 unit test, integration test, and acceptance test a sample application built with each of the TypeScript compatible frameworks. It discusses the concept of testability, and shows how subtle changes in application design and implementation can provide far better application test coverage. Chapter 10, Modularization, 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 finishes with an in-depth look at using modules within Node, and builds a sample Express application. Chapter 11, Object-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 12, Dependency 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 13, Building Applications, explores the fundamental building blocks of web application development, including generating HTML pages from Node and Express, writing and consuming REST endpoints, and data binding. It shows how to integrate an Express server, REST endpoints, and data binding with Aurelia, Angular 2, and React. Chapter 14, Let’s Get Our Hands Dirty, builds a single-page application using Angular 2 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, using Express REST endpoints, object-oriented design principles, modularization, and custom CSS animations.