Mastering TypeScript - Second Edition

[Pages:658] Mastering TypeScript - Second Edition

Table of Contents

Mastering TypeScript - Second Edition Credits About the Author About the Reviewers

Why subscribe? Customer Feedback Preface

What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support

Downloading the example code Downloading the color images of this book Errata Piracy Questions 1. TypeScript - Tools and Framework Options Introducing TypeScript The ECMAScript standard The benefits of TypeScript

Compiling Strong typing

TypeScript's syntactic sugar JavaScript and TypeScript definitions

DefinitelyTyped Encapsulation

TypeScript classes generate closures Public and private accessors TypeScript IDEs

Node-based compilation Creating a tsconfig.json file

Microsoft Visual Studio Creating a Visual Studio project Default project settings Debugging in Visual Studio

WebStorm Creating a WebStorm project Default files Building a simple HTML application Running a web page in Chrome Debugging in Chrome

Visual Studio Code Installing VSCode Exploring VSCode Creating a tasks.json file Building the project Creating a launch.json file Setting breakpoints Debugging web pages

Other editors Using Grunt

Summary 2. Types, Variables, and Function Techniques

Basic types JavaScript typing TypeScript typing Type syntax Inferred typing Duck typing Template strings Arrays for...in and for...of The any type Explicit casting Enums

Const enums Const values The let keyword Functions Function return types Anonymous functions Optional parameters Default parameters Rest parameters Function callbacks Function signatures Function overloads Advanced types Union types Type guards Type aliases Null and undefined Object rest and spread Summary 3. Interfaces, Classes, and Inheritance Interfaces Optional properties Interface compilation Classes Class properties Implementing interfaces Class constructors Class functions Interface function definitions Class modifiers Constructor access modifiers Readonly properties Class property accessors Static functions Static properties Namespaces

Inheritance Interface inheritance Class inheritance The super keyword Function overloading Protected class members Abstract classes JavaScript closures

Using interfaces, classes, and inheritance - the Factory Design Pattern Business requirements What the Factory Design Pattern does The IPerson interface The Person class Specialist classes The Factory class Using the Factory class

Summary 4. Decorators, Generics, and Asynchronous Features

Decorators Decorator syntax Multiple decorators Decorator factories Class decorator parameters Property decorators Static property decorators Method decorators Using method decorators Parameter decorators Decorator metadata Using decorator metadata

Generics Generic syntax Instantiating generic classes Using the type T Constraining the type of T Generic interfaces

Creating new objects within generics Asynchronous language features

Promises Promise syntax Using promises Callback versus promise syntax Returning values from promises Async and await Await errors Promise versus await syntax Await messages Summary 5. Writing and Using Declaration Files Global variables Using JavaScript code blocks in HTML Structured data Writing your own declaration file The module keyword Interfaces Union types Module merging Declaration syntax reference Function overrides Nested namespaces Classes Class namespaces Class constructor overloads Class properties Class functions Static properties and functions Global functions Function signatures Optional properties Merging functions and modules Summary 6. Third-Party Libraries

Downloading definition files Using NuGet

Using the Extension Manager Installing declaration files Using the Package Manager Console

Installing packages Searching for package names Installing a specific version Using Typings Searching for packages Typings initialize Installing definition files Installing a specific version Re-installing definition files Using Bower Using npm and @types Using third-party libraries Choosing a JavaScript framework Backbone Using inheritance with Backbone Using interfaces Using generic syntax Using ECMAScript 5 Backbone TypeScript compatibility Angular Angular classes and $scope Angular TypeScript compatibility Inheritance - Angular versus Backbone ExtJS Creating classes in ExtJS Using type casting ExtJS-specific TypeScript compiler Summary 7. TypeScript Compatible Frameworks What is MVC? The Model

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download