3 Best TypeScript Books for Beginners in 2021
TypeScript is perhaps one of the trickiest languages to pick up and learn because TypeScript lives co-dependently with other frameworks and concepts. To learn TypeScript is to learn theory and practical application at the same time.
So how do you begin?
There are not very many books on TypeScript for a couple of reasons:
The language is relatively young, which means that it’s turbulent and changes often, which makes writing a book on the topic difficult.
Learning TypeScript with a book is a journey, and this article aims to make your journey a little bit easier by recommending three solid TypeScript books.
jsx file to
tsx and congratulations! You’re writing in TypeScript.
If you understand the relationship between CSS and Sass, for example, you have a sense for what this means.
What makes the Best TypeScript Books?
The best TypeScript books for beginners are opinionated in order to make the best use of TypeScript’s features.
This can be tricky to maneuver, which is why an opinionated book on not just the functionality, but using TypeScript well, is vital to your success as a TypeScript developer.
For this article, I prioritized books that truly look out to building your skills as a developer — and not just giving you glossary definitions.
A TypeScript book would be best paired with the classic industry book, The Pragmatic Programmer. You want a TypeScript book that is opinionated, but you must also be equipped to think for yourself. The Pragmatic Programmer is the best book to cultivate that skill.
Best TypeScript Books in 2020
See below for the top 3 best TypeScript books for beginners in 2020.
Book 1: TypeScript Quickly
— TypeScript Quickly
TypeScript Quickly by Yakov Fain and Anton Moiseev is a February 2020 Manning publication that is one of the most well-organized, clear, and practical books I have seen on TypeScript. Every chapter is clear and concise, and you know where you are going every step of the way.
A challenge of teaching TypeScript is that TypeScript often doesn’t function alone. The language is often paired with another frontend framework like React or Angular. Like with other books, TypeScript Quickly decides to be opinionated by diving into frameworks as well.
As far as organization goes, TypeScript Quickly is one of the best. Its structure is clean and you know exactly what you are getting into every step of the way.
TypeScript Quickly includes the following sections:
Part 1: Mastering the TypeScript syntax, which includes:
Chapter 2: Basic and custom types, which includes declaring variables with types and using types in function declarations, declaring type aliases with the type keyword, and declaring custom types with classes and interfaces.
Chapter 3: Object-oriented programming with classes and interfaces, which includes how class inheritance works, why and when to use abstract classes, how interfaces can force a class to have methods with known signatures without worry about implementation details, and what programming to interfaces means.
Chapter 4: Using enums and generics, which includes the benefits of using enums, the syntax for numeric and string enums, what generic types are for, and how to write classes, interfaces, and functions that support generics.
Chapter 5: Decorators and advanced types, which includes what the TypeScript decorators are for, how to create a new type based on an existing one using mapped types, how conditional types work, and combining mapped and conditional types.
Chapter 6: Tooling, which includes debugging TypeScript code with the help of source maps, the role of linters, compiling and bundling TypeScript apps with Webpack, compiling TypeScript apps with Babel, and how to compile TypeScript with Babel and bundle it with Webpack.
Part 2: Applying TypeScript in a blockchain app, which includes:
Chapter 8: Developing your own blockchain app, which includes the principles of blockchain apps, what the hashing functions are for, what block mining is, and developing a simple blockchain-based app.
Chapter 9: Developing a browser-based blockchain node, which includes creating a web client for a blockchain, creating a small library for hash generation, and running ther blockchain web app and debugging TypeScript in the browser.
Chapter 10: Client-server communications using Node.js, TypeScript,a nd WebSockets, which includes why a blockchain may need a server, the longest chain rule, how to create a Node.js WebSocket server in TypeScript, and poractical uses of TypeScript interfaces, abstract classes, access qualifiers, enums, and generics.
Chapter 11: Developing Angular apps with TypeScript, which includes a quick intro to the Angular framework, how to generate, build, and serve a web app written in Angular and TypeScript, and how Angular implements dependency injection.
Chapter 12: Developing the blockchain client in Angular, which includes reviewing the code of the blockchain web client in Angular and how to run an Angular client that communicates with a WebSocket server.
Chapter 13: Devleoping React.js apps with TypeScript, which includes a quick intro to the React.js library, how React components use props and state, and how React components communicate with each other.
Chapter 14: Developing a blockchain client in React.js, which includes reviewing a blockchain web client written with React.js, how the React.js web client communicates with the WebSocket server, running a React app that works with two servers in dev mode, and splitting the UI of a blockchain client into components and arranging their communications.
Chapter 15: Developing Vue.js apps with TypeScript, which includes a quick introduction to the Vue.js framework, how to jumpstart a new project with Vue CLI, how to work with class-based components, an d how to arrange client-side navigation using the Vue Router.
Chapter 16: Developing the blockchain client in Vue.js, which includes reviewing the Vue.js version of the blockchain web client, running a Vue app that works with two servers in dev move, the flow of data, from entering a transaction to generating a block, and arranging communications between the blockchain’s client components.
Book 2: Effective TypeScript: 62 Specific Ways to Improve Your TypeScript
TypeScript has evolved rapidly over the past few years, but my hope is that it has stabilized enough that the content in this book will remain valid for years to come. This book focuses primarily on the language itself, rather than any frameworks or build tools. You won’t find any examples of how to use React or Angular with TypeScript, or how to configure TypeScript to work with webpack, Babel, or Rollup. The advice in this book should be relevant to all TypeScript users.
— Effective TypeScript
Effective TypeScript: 62 Specific Ways to Improve Your TypeScript by Dan Vanderkam is a 2020 O’Reilly publication designed specifically to improve your skills as a TypeScript developer.
The beauty of this book is in how opinionated it is, creating rules and preferences to follow all throughout the book. Yet, unlike the others books in this list, it remains isolated from other tools like React or Angular. This book is unique in that it self-purports to be your “second book on TypeScript,” but this book is on the list because of its great quality and value to all learners of TypeScript.
This TypeScript book can be paired with another TypeScript book on this list because the value of this book is unique.
This book is actionable, easy-to-apply, and helps you become a better TypeScript developer right away.
Effective Typescript includes the following sections:
Chapter 2: TypeScript’s Type System, which includes using your editor to interrogate the type system, thinking of types as sets of values, knowing how to tell the type of a symbol, preferring type declarations to type assertions, avoiding object wrapper types, recognizing the limits of excess property checking, applying types to entire function expressions, knowing the difference between type and inheritance, and more.
Chapter 3: Type Interference, which includes avoiding clustering your code with inferable types, using different variables for different types, understanding type widening, understanding type narrowing, creating objects all at once, being consistent with aliases, using async functions instead of callbacks for asynchronous code, and more.
Chapter 4: Type Design, which includes preferring types that always represent valid states, avoiding repeating type information in documentation, pushing null values to the perimeter of your types, and more.
Chapter 5: Working with any, which includes using the narrowest possible scope for any type, preferring more precise variants of any to plain any, hiding unsafe type assertions, and more.
Chapter 6: Types Declarations and @types, which includes putting TypeScript and @types in devDependencies, understanding the three versions involved in type declarations, exporting all types that appear in public APIs, and more.
Chapter 7: Writing and Running Your Code, which includes preferring ECMAScript features to TypeScript features, knowing how to iterate over objects, understanding the DOM hierarchy, and more.
This book has two aims: to give you the deep understanding of how the TypeScript language works (theory) and provide bucketfuls of pragmatic advice about how to write production TypeScript code (practice).
Because TypeScript is such a practical language, theory quickly turns to practice, and most of this books ends up being a mix of the two[.]
— Programming TypeScript
Programming TypeScript includes the following sections:
Chapter 1: Introduction, which includes a brief description of why you may want to learn TypeScript and unpacks the value of TypeScript type safety.
Chapter 3: All About Types, which includes “The ABCs of Types,” listing types order from
Chapter 4: Functions, which includes information about declaring and invoking functions, polymorphism as it relates to functions, type-driven development, and more.
Chapter 5: Classes and Interfaces, which includes information about classes and inheritance, super, using
thisas a return type, interfaces, polymorphism as it relates to classes, mixins, and more.
Chapter 6: Advanced Types, which includes information about relationships between types (including subtypes and supertypes), totality, advanced object types, conditional types, and “escape hatches” such as type assertion, nonnull assertions, and more.
Chapter 7: Handling Errors, which includes information about returning
null, throwing exceptions, returning exceptions, the option type, and more.
Chapter 9: Frontend and Backend Frameworks, which includes frontend frameworks like React and Angular as well as type safety to your APIs with tools like Swagger, gRPC, and GraphQL. This section also talks about using TypeORM for safe interaction with your database.
export, namespaces, declaration merging, and more.
Chapter 12: Building and Running TypeScript, which includes information about building your typescript project with layout, artifacts, source maps, error monitoring, and more. This section also talks about running TypeScript on the server or in the browser as well as publishing to NPM.
Chapter 13: Conclusion
TypeScript is a challenging programming language to learn because it is not TypeScript alone that you are learning. As you may have discovered from the books we covered about TypeScript, every book covers other technologies and always has an opinionated view about coding in TypeScript.
I enjoyed compiling these books for you. What surprised me the most was, for originally being developed in 2012, there is only a handful of quality books published on the topic — and many of them published in 2020.
I suspect that we have not seen the last of TypeScript books. In the coming years, I expect to see more quality books on this topic.
I hope that you find a lot of value from these books. To get the most value from technical books, I offer a free email course on the subject.