Å·±¦ÓéÀÖ

Jump to ratings and reviews
Rate this book

Effective TypeScript: 62 Specific Ways to Improve Your TypeScript

Rate this book
TypeScript is a typed superset of JavaScript with the potential to solve many of the headaches for which JavaScript is famous. But TypeScript has a learning curve of its own, and understanding how to use it effectively can take time. This book guides you through 62 specific ways to improve your use of TypeScript.

Author Dan Vanderkam, a principal software engineer at Sidewalk Labs, shows you how to apply these ideas, following the format popularized by Effective C++ and Effective Java (both from Addison-Wesley). You'll advance from a beginning or intermediate user familiar with the basics to an advanced user who knows how to use the language well.

Effective TypeScript is divided into eight


Getting to Know TypeScript
TypeScript's Type System
Type Inference
Type Design
Working with any
Types Declarations and @types
Writing and Running Your Code
Migrating to TypeScript

266 pages, Kindle Edition

First published January 1, 2019

302 people are currently reading
875 people want to read

About the author

Dan Vanderkam

3Ìýbooks18Ìýfollowers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
228 (49%)
4 stars
188 (41%)
3 stars
37 (8%)
2 stars
5 (1%)
1 star
0 (0%)
Displaying 1 - 30 of 46 reviews
Profile Image for Rob.
AuthorÌý2 books428 followers
October 13, 2020
As a long-time JavaScript developer, but as someone relatively new to TypeScript, this book was the right thing at the right time for me. I didn’t need an introductory-level book � TS being a superset of JS, after all, and syntax being something you can muddle through � but what I DID need was something that spoke to what was (1) idiomatic and (2) could shine a light on some of TS’s� idiosyncrasies.

This book helped me better frame my thinking around the so-called “type space� vs. the runtime code, as well as how to best consider TS’s structural typing as a good fit for JS’s notoriously loose types.

There are still some places where I scribbled “looks like more trouble than it’s worth� in the margins (but not too many) and I STILL have some work to do to get fluent in generics� BUT I would recommend this to anyone that has either (1) been working in TypeScript for 6+ months, and/or (2) who is coming I to TypeScript with a proficiency in JavaScript (looking at you, Dreyfus skill model).
Profile Image for ²Ñ²¹³ÙÄ›Âá.
4 reviews
November 14, 2019
The book structured into several areas, each presents you with a series of specific tips (the autor has listed the areas and tips on ). It assumes reasonable knowledge of both modern JS and TS. It definitely isn't a comprehensive intro to TS.

It dedicates about 1-4 pages to each tip, including motivation and detailed explanation with code samples. The writing is easy to understand and avoids any detours/asides and filler; all the code samples are clear and compact (none go past half-page length, most are ony a few lines of code). Each tip is clearly labeled so you can easily skip those that don't interest you. There are abundant cross-references where appropriate.

The tips are generally very environment agnostic - none of them deal with specific libraries/frameworks and only about 2 of them are specific to browser; none are specific to Node. Several of them are specific to library authoring though. Some of the tips seemed a bit obvious (especially early on, eg. "don't use Any") but many of them taught me a lot. I couldn't find any factual errors, however one or two of the tips left me unconvinced and perhaps would warrant even longer elaboration (especially the "use readonly" tip).

The book hit me in exactly the right spot. I'm an experienced developer and I've worked with JS on and off for many years, but my structured TS education is limited to the official tutorial. I was able to figure out most of it along the way (TS is intuitive if you have good JS knowledge and realize how it works, Google and SO helped a lot too), but this approach also left me with a lot of gaps in my knowledge, many of which I don't even realize I have. This book excels at plugging such gaps.

Now I have to go and refactor some of my code in the light of what I've learned.
Profile Image for TK.
99 reviews86 followers
October 25, 2023
I come from a place where I'm pretty familiar with TypeScript before reading this book. But it was a great experience learning more about this language in depth.

The first chapter was awesome in a way that the book shows more about language than simply about syntax. It talks about the relationship between JavaScript and TypeScript, how does structural typing works, and the differences between the type and value spaces.

The second chapter discusses how TypeScript can improve the developer experience with a code editor.

The following chapters are about how we can use types to be more effective.

I used this book as a reference to write my long-format essay about .

I really recommend this book for beginners and experienced developers.
Profile Image for Lucy  Batson.
468 reviews9 followers
March 13, 2021
It can be hard to figure out exactly what goes where when writing TypeScript, but this book is an opinionated guide that backs up its reasoning and greatly reduces decision fatigue on how to employ it in applications. This is essential reading for any developer using TypeScript!
Profile Image for Alireza Heydari.
35 reviews4 followers
Read
May 14, 2022
You may expect to see just TypeScript suggestions, but the book takes a deep dive into structural typing, JS complex logics, and mostly shows a way to have a great design for the application. Also shows a lot of code smells. The only problem would be that there were a lot of reference to each item and also the book was not updated by the newest version of TS, so some parts were just old.

Also consider this book just as a helper. It's not complete, but necessary maybe!
Profile Image for Alex.
52 reviews10 followers
November 7, 2021
I am a huge fan of C++ Effective series and have read all the books many times so this book was a no-brainer and I think it managed to retain the vibe.
The book is great at identifying some good practices and some traps. I am still finding my peace with Typescript, but I can see the type system goodness as well.
I came to JavaScript from C/C++/Go background so it was a massive mindset shift on its own. The idea of type "safe" JavaScript appealed to me very much, however in practice it turned out to be very different from the "normal" type safe languages and most of the type safeness are just pinky promises to stick to the contract - the promises that can be easily broken in runtime. :)
I'm definitely keeping the book on my desk as a reference going forward (along with Programming Typescript book which is also great).
Profile Image for Mary.
1,368 reviews13 followers
February 10, 2020
We read the introduction and that probably was our limit. But I am fond of the author and very proud of his work and thus am rating this book five stars.
Profile Image for Kevin Garner.
18 reviews4 followers
April 16, 2021
I've used TypeScript in a variety of settings since it came out. I've leveraged the features that are now considered historical curiosities (Enums, namespaces, triple-slash references... I'm looking at you 👀). I've migrated a legacy WebForms / jQuery application to TypeScript 😱. I've maintained multiple Angular applications driven entirely on TypeScript. I've written source generators that create TypeScript contracts from C# models. I've made my own hobbyist Vue and React applications with TypeScript. I've even written some Deno applications here and there. Despite all that, I learned so much about TypeScript by reading this book, things that I wish I knew before!

This book is an easy 5 stars. As you read it, you develop what the author calls mental models for understanding and using TypeScript. The book contains excellent advice and a full rundown of TypeScript's type system. People coming from OO languages like C# will be able to really disambiguate TypeScript's type system from their own typed language. People coming from a purely JavaScript background will be given what I think is the gold standard of instruction on how to use TypeScript. And, you can test-drive all of the code samples on a site like .

I read it digitally, and I will be getting a hard copy of this book to reference and reread in the future. If you want to learn *effective TypeScript*, check out this book.
Profile Image for dantelk.
193 reviews19 followers
October 29, 2024
Not bad, but not great either.

I think I don't like those "100 Java mistakes" or "62 TS tricks" type books - feels like the book is lacking a specific topic, and insufficient primer teachings are supplied to the reader.

Good part: This one had very interesting topics to discuss, and I took lots of notes about how TS mechanisms work, and I was genuinely surprised by how TS behaves. I even realized I didn't know the difference between let and var, shame on me!! Also, the binding "anomaly" of "this" keyword was something I never heard of, and I still need to read more on that.

Bad part: I didn't enjoy reading this book... I think the selected 62 ways were clever, but the explanations were dull and boring. Many times, I had to supplement what I've read on Youtube or other text on the internet. At the end, I still have 5 more titles to read, and I have zero ambition to continue reading.

I give this book 3 stars. Actually, I would recommend reading this book to other JS/TS developers. But be warned: this is not a beginners level book, and don't read this one for the sake of pleasure, you won't get any.

I think Deborah Kurata's Youtube videos are more clear in explaining TS (and Angular) concepts.

(btw, I've just started reading a great Angular book. After "Effective TypeScript", it felt like medicine kehkeh :P)

(maybe my TS knowledge level is too low for this book's level :)
Profile Image for John.
200 reviews
February 15, 2020
The author posted about this book on reddit, and it looked good so I bought a copy straight away. Nice job, Dan!

The book is mostly very good. I've been using TypeScript for 3 years now, so it mostly wasn't so new to me, but it did clarify a lot of the things I knew. In particular, as I haven't read a whole lot of TypeScript code, the convention of using discriminated unions was new to me, and I hadn't really understood how well TypeScript supports it.

I did think the description of transitive dependencies was a bit of a shambles (I can't find the section to say which it was), but I learnt about transitivity in maths classes, so any non-mathematical description of it is going to make me twitch... maybe it's just me.

I'm a little torn between giving 3 and 4 stars, as I felt I didn't learn a whole lot, and large sections kinda stretched the concept of "specific ways". On the other hand, I did make improvements to some of the older TypeScript in my Angular projects, and I did get a bit overexcited writing types in a new project, so I went with the 4 stars. It's possible that a younger programmer than me, who's interested in migrating to TypeScript from JavaScript, could get very excited indeed about this book.
Profile Image for Lukasz.
25 reviews1 follower
June 4, 2020
I use Typescript for few years already and I find this book really great if you have some experience with TS.

It will be rather poor choice for super beginners (however might be ok if you migrate from C# and you learn it in parallel with JS), but TS users can find a lot of understanding of TS best practices

It has nice structure of "pro tips" - you can skip part which is obvious to you.

Also it has a chapter how to migrate legacy codebase to TS.

It definitely helped me and I used some of the protips literally next day.

Profile Image for Ferhat Elmas.
821 reviews13 followers
September 15, 2023
A successful member of the effective series, has useful examples of common pitfalls with detailed / coded explanations.
Profile Image for Jesus.
90 reviews2 followers
February 27, 2021
Interesante libro con muchas cosas que no conocía de Typescript. Muchas veces empezamos a tocar tecnologías que no conocemos y vamos aprendiendo sobre la marcha (haciendo mal las cosas) y este libro ha un vistazo rápido pero profundo de lo que Typescript tiene a tu disposición
Profile Image for Redowan Delowar.
46 reviews5 followers
June 5, 2022
I'm a diaspora from the Python land who's not only new to TypeScript but to the entire JavaScript ecosystem in general. Although not too fond of the weakly typed nature of JavaScript, I'm simply infatuated with what Microsoft did with TypeScript.

After reading the Handbook and TypeScript Deep Dive by Basarat Ali Syed, I was looking for something more advanced and example-driven, and this book doesn't disappoint in that aspect. It's clear, concise, and contains tons of examples of how to work with the type checker instead of fighting it. Highly, recommended if you've already gone through the official Handbook and looking for more practical advice. Happy typescripting!
Profile Image for Glen.
9 reviews
November 29, 2019
I really enjoyed the format. The short sections provided illustrating examples and just enough detail. Every time I put the book down, I felt like I had learned something I could apply immediately.
17 reviews
August 10, 2020
Great book! I thought I knew a lot about TypeScript already, but this book has some tips I did not know before and not readily found on the internet.
Profile Image for Rafael Gonzaga.
6 reviews3 followers
January 10, 2021
Most of part of the book is useful information, however, this information is already well known by developers who work with typescript.
6 reviews
February 20, 2023
3.5/5

Pretty informative book on advanced TypeScript. This book is more for the intermediate developer not the beginner. I had a hard time understanding the code given I barely used TypeScript.

It is a typical informative technical book and explained things about TypeScript that is unintuitive. I would give it a 4/5 if it was presented in a more engaging way. It felt boring.

All it did was talk about types and not much anything else. Nothing about thinking in TS, design patterns, broad concepts, common mistakes.

I would like to quote one of the previous reviewers whom I agree with, Andrew Violette:

"Compared to other "effective" books I've read (particularly "Effective Java" and "Effective Python"), this books spends very little energy on anything outside the type system. For instance, the "Effective Python" book only had one chapter on the type system (granted, it's considerably less confusing than typescript's). Other chapters included 'Thinking pythonically', writing documentation, functions, etc. This book needs some of that."
Profile Image for Andrew Violette.
111 reviews4 followers
October 19, 2022
3.5/5. This book had lots of tips on navigating Typescript's convoluted type system. Compared to other "effective" books I've read (particularly "Effective Java" and "Effective Python"), this books spends very little energy on anything outside the type system.

For instance, the "Effective Python" book only had one chapter on the type system (granted, it's considerably less confusing than typescript's). Other chapters included "Thinking pythonically", writing documentation, functions, etc. This book needs some of that.

Profile Image for Roman Mkrtchian.
44 reviews2 followers
January 7, 2024
I've been using TypeScript for several years, and still I picked up numerous helpful tricks from the book, and deepened my understanding of the type system, inference mechanics, and more. The book's structure is itemized, making it a swift read for those already familiar with TypeScript. This allows you to concentrate on what you don't know.
While some of the author's opinions may spark disagreement, it's this very aspect that lends the book its practicality.
Profile Image for Stefan Kanev.
125 reviews233 followers
December 22, 2019
This book is a collection of 62 nuggets of information about TypeScript (advices, suggestions, clarifications, best practices, etc.). It’s targeted at someone who already knows TypeScript and wants to learn more.

I absolutely love it. It explained a couple of things I didn’t understand and generally has good advice.

It’s a great second TypeScript book.
Profile Image for Viktor Malyshev.
133 reviews4 followers
August 23, 2022
A good book about Typescript. The author starts from the very basics, then explores the type system and everything Typescript offers. A good chapter about any. The last chapter is about JS in general (funny, right?). I love to see how people are being thought about something that's built on JS without JS knowledge.
Overall, a good book for a newbie, good start for Typescript
Profile Image for Nicholas Charriere.
11 reviews1 follower
April 20, 2023
Concise, useful and directly applicable.

I recommend this book to people looking to go from intermediate to expert in their typescript. The author does a fantastic job of condensing ideas into simple and clear examples, and the numbered tips methodology makes it very easy to bookmark things and reuse them later (quite directly).

This book had a direct impact on my production code within a week.
Profile Image for Sean.
81 reviews5 followers
May 6, 2023
Offers exactly what it says on the cover. The author's clear, concise writing and effective examples make the book accessible to newcomers and old hands alike. While the evolution of both JavaScript and TypeScript have left a point or two here and there slightly dated (or are in the process of doing so), the fundamentals conveyed are unlikely to lose their relevance for years to come.
Profile Image for Diego Pacheco.
163 reviews10 followers
October 4, 2021
It's a good book. Remind me a lot of effective Java. I like a lot the part where the author covers the issues and limitations with TypeScript. The book does not cover all Type utilities in Typescript, it covers some like Unions, type but many as left over. It's a good book anyways.
Profile Image for Sebastian Sanio.
267 reviews2 followers
October 6, 2022
Right now I am actively using javascript and I wanted to understand the benefits of using typeacript, this book covers that plus a lot of hints on good practices and how to go from js to ts.
The book assumes knowledge of js at a mid level.
1 review
July 2, 2023
Good TypeScript Tips, some are a bit outdated though

As the author stated in the book, it was written when TS was still version 3.9. It's now 5.1, a few things have changed, but the good tips remain good nonetheless.
Profile Image for alper.
206 reviews60 followers
October 23, 2023
Yazmayacaktım da tutamadım kendimi. Ne günlere kaldık. Şunlarla be yazıyorlar şaka gibi. Neyse daha fazla sinirlenmeyeceğim... Kabullendim ben. Yani o evreye geldim. Arada önceki adımlara dönüyorum ama sonra efendi efendi okuyorum kitaplarımı. :P
Profile Image for Trung.
189 reviews3 followers
October 23, 2020
Finally, finish this fantastic book after a few months. I think this kind of book need times to digest and apply to my day-to-day task. An excellent resource for TypeScript!
Displaying 1 - 30 of 46 reviews

Can't find what you're looking for?

Get help and learn more about the design.