TypeScript Programming
TypeScript Programming
Summary:
Introduction
The book "Programming TypeScript" by Boris Cherny was published in 2019 and instantly became one of the most authoritative guides to the TypeScript language. Boris Cherny is an engineer who worked at Facebook on the Flow project and is an active member of the TypeScript community. His book not only introduces the syntax but teaches you to think in terms of types and build reliable, scalable applications. In 326 pages, the author manages to cover both the basics and deep topics such as conditional types, covariance, and contravariance, making it unique among many superficial tutorials.
What the book is about
The book is divided into three logical parts. The first part introduces the basics: environment setup, basic types, functions, interfaces, and classes. The second part — the heart of the book — is dedicated to the advanced type system: generics, conditional types, mapped types, type inference, as well as working with errors and exceptions. The third part covers the practical application of TypeScript in real projects: integration with React, Angular, Node.js, working with untyped libraries (via ambient declarations), as well as tips on refactoring and testing. A separate chapter is devoted to decorators and their use in frameworks.
Who this book is for
The book is intended for developers already familiar with JavaScript (ES6+) who want to switch to TypeScript or deepen their knowledge. It will be useful both for beginners just starting to use TypeScript and for experienced engineers wanting to understand the complex mechanisms of the type system. If you write in Python and want to understand how static typing can improve your code (especially in the context of TypeScript), the book will also be a good introduction, although it will require knowledge of JavaScript.
What the reader will learn
- TypeScript basics: installation, compilation, tsconfig, basic types (number, string, boolean, null, undefined, void, never, any, unknown).
- Interfaces and types: the difference between interface and type, extension, union, intersection types.
- Functions: typing parameters, return values, function overloading, this in TypeScript.
- Classes and OOP: access modifiers, abstract classes, inheritance, mixins.
- Generics: generic functions, classes, interfaces, constraints (extends), conditional types, infer.
- Advanced types: mapped types, keyof, typeof, lookup types, template literal types.
- Typing third-party code: creating declaration files (.d.ts), working with DefinitelyTyped, ambient modules.
- Integration with frameworks: React (hooks, props, children), Angular (services, components, DI), Node.js (middleware, Express).
- Decorators: class, method, property, parameter decorators — theory and examples.
- Testing and debugging: unit tests with Jest, type debugging, common pitfalls.
Strengths
The first thing that stands out is the depth of material presentation. The author doesn't just list the language's capabilities but explains why a particular construct works the way it does, what trade-offs exist, and how to avoid typical mistakes. The second is the practical focus: each chapter contains code examples that can be immediately applied in practice. The third is the structure: from simple to complex, with clear transitions and summaries at the end of chapters. The fourth is relevance: despite being from 2019, the book covers TypeScript version 3.x, but most concepts (conditional types, mapped types, infer) remain fundamental in modern versions (4.x, 5.x). The fifth is the style: Boris writes in a lively, engaging language with a touch of humor, which makes reading
Recommendations
Refactoring Rust Code: A Practical Guide
Swift (iOS/macOS) and Databases: A Practical Guide
Go (Golang) Application Security: From Basics to Advanced Techniques
Refactoring Swift (iOS/macOS) Code
PHP The Right Way: Best Practices and Quick Tips
Professional Android. Application Development for Professionals