Concurrency in TypeScript: Asynchronous and Parallel Programming
Concurrency in TypeScript: Asynchronous and Parallel Programming
Summary:
Modern web development is unthinkable without asynchronous code. Handling API requests, working with files, data streaming, real-time — all of this requires a deep understanding of concurrency. The book "Concurrency in TypeScript" is a practical guide that will help you move from basic use of async/await to professional design of multi-threaded and high-load systems.
The author, Alexey Sokolov, a senior developer with 10 years of experience, systematically reveals the inner workings of JavaScript/TypeScript: from the Event Loop and microtasks to Worker Threads and SharedArrayBuffer. You will learn how TypeScript's static typing helps avoid classic asynchronous code errors.
Who is this book for?
- Frontend and backend developers in TypeScript and JavaScript who want to write fast and reliable code;
- Developers transitioning from synchronous languages (Java, Python, C#) to Node.js;
- Professionals preparing for technical interviews on complex concurrency topics;
- Anyone who wants to understand how modern frameworks (React, Angular, NestJS) work under the hood.
What will you learn?
- Asynchrony basics: callbacks, promises, chaining, error handling, Promise.all/race/allSettled;
- Async/await in detail: how state generation works, debugging async functions, typing with TypeScript;
- Event Loop and queues: microtasks, macrotasks, timers, requestAnimationFrame, setImmediate;
- Parallelism: Web Workers, Worker Threads, data transfer, SharedArrayBuffer, Atomics;
- Concurrency patterns: Producer-Consumer, Pipeline, Fan-out/Fan-in, Throttle/Debounce, Retry with backoff;
- Reactive programming: RxJS, Observable, Subject, concurrency operators;
- Advanced topics: Streams, async generators, AbortController, cancellation, signals;
- Performance: benchmarking, profiling, memory leaks in asynchronous code.
Each chapter contains practical examples, ready to run, and exercises to reinforce the material. The book is written in a lively language with an emphasis on real-world scenarios: from creating a fast HTTP server to processing gigabyte-sized files and implementing a real-time chat.
Make your code truly concurrent — and let users not wait!