Programming TypeScript

by Boris Cherny

Programming

Book Details

Book Title

Programming TypeScript

Author

Boris Cherny

Publisher

O′Reilly

Publication Date

2019

ISBN

1492037656

Number of Pages

435

Language

English

Format

PDF

File Size

21MB

Subject

Programming-TypeScript

Table of Contents

  • Preface
  • 1. Introduction
  • 2. TypeScript: A 10_000 Foot View
  • The Compiler
  • The Type System
  • Code Editor Setup
  • index.ts
  • Exercises
  • 3. All About Types
  • Talking About Types
  • The ABCs of Types
  • Summary
  • Exercises
  • 4. Functions
  • Declaring and Invoking Functions
  • Polymorphism
  • Type-Driven Development
  • Summary
  • Exercises
  • 5. Classes and Interfaces
  • Classes and Inheritance
  • super
  • Using this as a Return Type
  • Interfaces
  • Classes Are Structurally Typed
  • Classes Declare Both Values and Types
  • Polymorphism
  • Mixins
  • Decorators
  • Simulating final Classes
  • Design Patterns
  • Summary
  • Exercises
  • 6. Advanced Types
  • Relationships Between Types
  • Totality
  • Advanced Object Types
  • Advanced Function Types
  • Conditional Types
  • Escape Hatches
  • Simulating Nominal Types
  • Safely Extending the Prototype
  • Summary
  • Exercises
  • 7. Handling Errors
  • Returning null
  • Throwing Exceptions
  • Returning Exceptions
  • The Option Type
  • Summary
  • Exercises
  • 8. Asynchronous Programming, Concurrency, and Parallelism
  • JavaScript’s Event Loop
  • Working with Callbacks
  • Regaining Sanity with Promises
  • async and await
  • Async Streams
  • Typesafe Multithreading
  • Summary
  • Exercises
  • 9. Frontend and Backend Frameworks
  • Frontend Frameworks
  • Typesafe APIs
  • Backend Frameworks
  • Summary
  • 10. Namespaces.Modules
  • A Brief History of JavaScript Modules
  • import, export
  • Namespaces
  • Declaration Merging
  • Summary
  • Exercise
  • 11. Interoperating with JavaScript
  • Type Declarations
  • Gradually Migrating from JavaScript to TypeScript
  • Type Lookup for JavaScript
  • Using Third-Party JavaScript
  • Summary
  • 12. Building and Running TypeScript
  • Building Your TypeScript Project
  • Running TypeScript on the Server
  • Running TypeScript in the Browser
  • Publishing Your TypeScript Code to NPM
  • Triple-Slash Directives
  • Summary
  • 13. Conclusion
  • A. Type Operators
  • B. Type Utilities
  • C. Scoped Declarations
  • D. Recipes for Writing Declaration Files for Third-Party JavaScript Modules
  • E. Triple-Slash Directives
  • F. TSC Compiler Flags for Safety
  • G. TSX
  • Index