Contents

About the Author

Acknowledgments

Introduction

image Chapter 1: TypeScript Language Features

JavaScript Is Valid TypeScript

Variables

Types

Type Annotations

Primitive Types

Arrays

Enumerations

Type Assertions

Operators

Increment and Decrement

Binary Operators

Bitwise Operators

Logical Operators

Type Operators

Functions

Optional Parameters

Default Parameters

Rest Parameters

Overloads

Specialized Overload Signatures

Arrow Functions

Interfaces

Classes

Constructors

Access Modifiers

Properties and Methods

Class Heritage

Scope

Type Information

Modules

Internal Modules

External Modules

Module Loading

Export Assignments

Module Merging

Generics

Generic Functions

Generic Interfaces

Generic Classes

Type Constraints

TypeScript Futures

Summary

image Chapter 2: The Type System

Type Systems

Optional Static Types

Structural Typing

Type Erasure

Type Inference

Best Common Type

Contextual Types

Widened Types

When to Annotate

Duplicate Identifiers

Type Checking

Ambient Declarations

Declaration Files

Definitely Typed

Summary

Key Points

image Chapter 3: Object Orientation in TypeScript

Object Orientation in TypeScript

Open Recursion

Encapsulation

Delegation

Polymorphism

SOLID Principles

The Single Responsibility Principle (SRP)

The Open–Closed Principle (OCP)

The Liskov Substitution Principle (LSP)

The Interface Segregation Principle (ISP)

The Dependency Inversion Principle (DIP)

Design Patterns

The Strategy Pattern

The Abstract Factory Pattern

Practical Example

Mixins

TypeScript Mixins

When to Use Mixins

Restrictions

Summary

Key Points

image Chapter 4: Understanding the Runtime

Runtime Features

Scope

Variable Hoisting

Callbacks

Passing Functions as Arguments

Events

TypeScript’s Custom-Event Mechanism

Event Phases

Extending Objects

Extending the Prototype

Sealing Objects

Alternatives to Extending

Summary

Key Points

image Chapter 5: Running TypeScript in a Browser

The Anatomy of a Web Browser

Reflows

The Interesting Components

The Document Object Model

Finding Elements

Changing Elements

Events

Frameworks and Libraries

Network

AJAX

WebSockets

Real-Time Communications

Storage

Session Storage

Storage Restrictions

IndexedDB

Storage Roundup

Geolocation

Sensors

Battery Status

Proximity Sensor

Light Sensor

Motion and Orientation

Temperature, Noise, and Humidity

Sensor Roundup

Web Workers

Packaging Your Program

Summary

Key Points

image Chapter 6: Running TypeScript on a Server

Install Node

Creating a New Project

Simple Node Program

Request Information

Using Express to Write Applications

Simple Express Program

Multiple Routes

Handling Errors

Express Book Project

Summary

Key Points

image Chapter 7: Exceptions, Memory, and Performance

Exceptions

Throwing Exceptions

Exception Handling

Memory

Releasing Resources

Garbage Collection

Performance

Summary

Key Points

image Chapter 8: Using JavaScript Libraries

Creating Type Definitions

Creating a TypeScript Application with Knockout

Silencing the Compiler

Iteratively Improving Type Definitions

Converting a JavaScript Application

Summary

Key Points

image Chapter 9: Automated Testing

Framework Choices

Testing with Jasmine

Installing Jasmine

The First Specification

Driving the Implementation

Refactoring

Isolating Dependencies

Summary

Key Points

image Appendix 1: JavaScript Quick Reference

Variables

Functions

Conditional Statements

Loops

Summary

image Appendix 2: TypeScript Compiler

Getting Help

Common Flags

Module Kind

ECMAScript Target Version

Generate Declarations

Remove Comments

Combined Output

No Implicit Any

image Appendix 3: Bitwise Flags

Bit Flags Explained

Bitwise Operations

image Appendix 4: Coding Katas

Performing a Kata

The Fizz Buzz Kata

Requirement 1

Requirement 2

Requirement 3

Requirement 4

Requirement 5

Fizz Buzz Summary

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.76.164