5 Best TypeScript Books for Beginners in 2022

typescript-quickly-mockup

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?

Getting Started With TypeScript

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.

  • TypeScript is challenging to write about. Because TypeScript is so tightly coupled with JavaScript and other concepts, the book needs to be especially opinionated about its scope.

Books need to weigh how much modern JavaScript it teaches as well as other programming concepts and frameworks in back and front end development. That means each book needs to define what it means to be a “beginner” in the language.

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.

TypeScript vs JavaScript: What is TypeScript?

TypeScript is a superset of JavaScript. TypeScript offers all of the same features of JavaScript — and more. Think of yourself pre- and post-morning coffee. Your post-coffee self can do everything your pre-coffee self can — but more and better!

TypeScript is a superset of JavaScript. TypeScript offers all of the same features as JavaScript — and more. Think of yourself pre- and post-morning coffee. Your post-coffee self can do everything your pre-coffee self can — but more and better!

TypeScript compiles into JavaScript, and JavaScript is ultimately what runs on your browser. TypeScript’s purpose is to be compiled into JavaScript. There is more, perhaps to add to the confusion: JavaScript itself is valid TypeScript because TypeScript is a superset of JavaScript. You can simply change your js or jsx file to ts or tsx and congratulations! You’re writing in TypeScript.

If you understand the relationship between CSS and Sass, for example, you have a sense of what this means.

TypeScript was developed by Microsoft as an open-source project in 2012. It offers a wealth of features that JavaScript does not offer. One of the most powerful features TypeScript has is robust ways of working with object types.

TypeScript throws specific errors to help you debug. TypeScript also compiles into older versions of JavaScript, which allows your applications to be accessible by many browsers.

If you are not comfortable with JavaScript itself, I recommend learning JavaScript before diving into TypeScript. For learning JavaScript, I’ve compiled a list of the best books for learning modern JavaScript.

 

What makes the Best TypeScript Books?

Teaching TypeScript can go in infinite directions. For a great TypeScript book to teach effectively, it must be opinionated.

Teaching TypeScript can go in infinite directions. For a great TypeScript book to teach effectively, it must be opinionated.

TypeScript is a unique language to learn by nature. Because TypeScript compiles into JavaScript, you don’t just learn syntax and features then be on your way.

The best TypeScript books for beginners are opinionated in order to make the best use of TypeScript’s features.

Because JavaScript itself is valid TypeScript, ‘knowing TypeScript’ can be more accurately described as using TypeScripts’ functionality to the fullest.

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 web 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 one of the best TypeScript books to cultivate that skill.

 
 

Best TypeScript Books

See below for the top 5 best TypeScript books for beginners.

Book 1: TypeScript Quickly

We use TypeScript daily, and we like it a lot! We really like TypeScript for allowing us to focus on the main problem we’re solving and not on typs in an object’s property name. In TypeScript programs, the chances of getting runtime errors are substantially lower compared to code originally written in JavaScript. We also like that IDEs offer great TypeScript support and literally walk us through the maze of APIs from third-party libraries we use in projects.

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.

This book is all about helping you become a more productive developer on web or standalone apps. The authors are practitioners, writing for practitioners — so the book outlines the process of building multiple apps using TypeScript and other popular libraries and frameworks. The book assumes knowledge of HTML, CSS, and modern JavaScript already.

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 1: Getting familiar with TypeScript, which includes the benefits of programming in TypeScript, Typescript vs JavaScript, how to compile TypeScript code into JavaScript, and how to work with the Visual Studio Code editor.

    • 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.

    • Chapter 7: Using TypeScript and JavaScript in the same project

  • 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, running the blockchain web app, and debugging TypeScript in the browser.

    • Chapter 10: Client-server communications using Node.js, TypeScript, and 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 practical 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: Developing 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, and 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 other books on 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 1: Getting to Know TypeScript, which includes understanding TypeScript vs JavaScript, knowing which TypeScript options you’re using, understanding that cod generation is independent of types, getting comfortable with structural typing, and limiting the use of any one type.

  • 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 cluttering 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.

  • Chapter 8: Migrating to TypeScript, which includes writing modern JavaScript, using @ts-check and JSDoc to experiment with TypeScript, using allowJs to mix TypeScript and JavaScript, and more.

Book 3: Programming TypeScript: Making Your JavaScript Applications Scale

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: Making Your JavaScript Applications Scale by Boris Cherny is a beginner-friendly book published in May 2019 that is intensely practical and written in a conversational, fun, and humorous style. The book is ‘light’ for its 324 pages and serves as a solid introduction without overwhelm.

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 2: TypeScript: a 10_—- Foot View, which includes information about the compiler, the type system, TypeScript vs JavaScript, code editor setup, and more.

  • Chapter 3: All About Types, which includes “The ABCs of Types,” listing types order from any to void.

  • 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 this as 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, non-null assertions, and more.

  • Chapter 7: Handling Errors, which includes information about returning null, throwing exceptions, returning exceptions, the option type, and more.

  • Chapter 8: Asynchronous Programming, Concurrency, and Parallelism, which includes information about JavaScript’s event loop, working with callbacks, promises, async and await, event emitters, typesafe multithreading, 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.

  • Chapter 10: Namespaces Modules, which includes information about JavaScript’s history with modules, import and export, namespaces, declaration merging, and more.

  • Chapter 11: Interoperating with JavaScript, which includes information about ambient type declarations, migrating from JavaScript to TypeScript, type lookup for JavaScript, using third-party JavaScript, 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

Book 4: Essential Typescript 4: From Beginner to Pro

This book is ideal for JavaScript developers looking to learn TypeScript. Some of the topics covered in this book include TypeScript tools, benefits, and usage. It teaches the fundamentals of TypeScript and starts by providing the reader with a firm grasp of language and tools.

You will then become more familiar with TypeScript for front-end and back-end development, customizing TypeScript, and testing TypeScript code.

Essential Typescript 4

Essential Typescript 4: From Beginner to End written by Adam Freeman allows the reader to learn all the essentials and beyond of TypeScript. He explains how to get the most out of it while teaching you how to reduce typing errors and find an easier path to JavaScript development.

Freeman provides real-world examples of how TypeScript can be used, including development with the DOM API and popular frameworks like Angular and React. He starts with the basics and moves up to more advanced features. Readers will find that each topic is covered in its entirety while being clear and concise.

With this book, you can gain a better understanding of TypeScript language and tools, use it for client and server-side development, extend and customize it, test your code, and then apply it.

Essential TypeScript 4 includes the following sections:

Introduction: Getting Started with TypeScript

  • Chapter One: Your First TypeScript Application, which includes installation, initializing the project, using a third-party package, adding commands, and persistently storing data

  • Chapter Two: Understanding TypeScript, which includes information on how TypeScript should be used, what you need to know, finding errors, and also offers examples.

  • Chapter Three: JavaScript Primer, Part One, which includes information on different JavaScript types and how to work with arrays and objects.

  • Chapter Four: JavaScript Primer, Part Two, which includes more information about JavaScript Object Inheritance, how to use iterators and generators, and how to use JavaScript Collections and modules

  • Chapter Five: Using the TypeScript Compiler, which includes information regarding project structure and how to use the node package manager. You will also learn to compile TypeScript code and use the version targeting feature.

  • Chapter Six: Testing and Debugging TypeScript, which includes debugging TypeScript code, using the TypeScript Linter, and testing.

  • Chapter Seven: Understanding Static Types, which includes creating and using static types, and using type unions, type assertions, and type guards.

  • Chapter Eight: Using Functions, which includes redefining functions, understanding function parameters, function results, overloading function types, and assert functions.

  • Chapter Nine: Using Arrays, Tuples, and Enums, which includes working with these and how to use each type.

  • Chapter Ten: Working with Objects, which includes information on how you can use type aliases for shape types, how to deal with excess properties, and how to use type intersections.

  • Chapter Eleven: Working with Classes and Interfaces, which includes using constructor functions, classes, interfaces, and dynamically creating properties.

  • Chapter Twelve: Using Generic Types, which includes how to create generic classes and define generic interfaces.

  • Chapter Thirteen: Advanced Generic Types, which includes more detailed information regarding generic collections and iterators, index types, type mapping, and conditional types.

  • Chapter Fourteen: Working with JavaScript, which teaches how to use JavaScript and describes types used in JavaScript code.

  •  Chapter Fifteen: Creating a Standalone Web App, Part One, which includes how to create the toolchain, add a bundler, render HTML content using the DOM API, using JSX to create HTML content, and how to add features to the application.

  •  Chapter Sixteen: Creating a Standalone Web App, Part Two, which includes information on how to add web services, use decorators, and complete the application.

  •  Chapter Seventeen: Creating an Angular App, Part One, which covers how to configure web service, how to create the data model, and how to display a filtered list of products.

  •  Chapter Eighteen: Creating an Angular App, Part Two, which includes information on completing the application features and deploying the app.

  •  Chapter Nineteen: Creating a React App, Part One, this shows you how to define entity types and create the data store.

  •  Chapter Twenty: Creating a React App, Part Two, teaches configuring example application features, how to deploy the application, and containerizing the app.

  • Chapter Twenty One: Creating a Vue.js App, Part One teaches TypeScript in Vue.js development, how to create entity classes, and how to add support for the web service.

  • Chapter Twenty Two: Creating a Vue.js App, Part Two covers how to complete, deploy, and containerize the application.

Book 5: Mastering Typescript, 4th Edition

Mastering TypeScript is for absolute beginners. You don't even have to have knowledge about JavaScript development before diving into the contents of this book.

It is a TypeScript deep dive into the basics and gives you detailed information and practical examples as you work your way up to more advanced topics and features.

Mastering Typescript

Mastering TypeScript by Nathan Rozentals helps you understand serverless techniques, micro frontend development, and the best practices so you can create high quality apps.

With this book, you also gain insights into core and advanced TypeScript language features and how to integrate with existing Javascript libraries and third-party frameworks.

Mastering TypeScript includes the following sections:

  1. Up and Running Quickly

  2. Exploring the Type System

  3. Interfaces, Classes, Inheritance, and Modules

  4. Generics and Advanced Type Inference

  5. Asynchronous Language Features

  6. Decorators

  7. Integration with JavaScript

  8. Strict Compiler Options

  9. Using Observables to Trasform Data

  10. Test-Driven Development

  11. Angular

  12. React

  13. Vue

  14. Node and Express

  15. An AWS Serverless API

  16. Micro Front-Ends

This book is sure to help guide you through your existing Javascript project as you learn more about TypeScript basics and more advanced concepts.

 

More Ways to Learn TypeScript

TypeScript is a challenging programming language to learn because it is not TypeScript alone that you are learning.

With any challenge, it’s best to have multiple forms of input so that you are retaining as much as possible. That’s why I recommend pairing a book with an inexpensive (or sometimes free) online course.

Courses You Can Take to Learn TypeScript

Also, if you are interested in finding more quality books about JavaScript and front-end development, you will love this article on the best JavaScript books in 2020. I hope to see you over there. And if not, I wish you a wonderful day. 👋😊

 

Miranda Limonczenko

Miranda is the founder of Books on Code, with a mission to bring book-lover culture to programmers. Learn more by checking out Miranda on LinkedIn.

http://booksoncode.com
Previous
Previous

5 Best AngularJS Books for a Modern 2022

Next
Next

9 Best JavaScript Books for Beginners in 2022