X-Team Blog - The Most-Loved Company for Engineers

Michał Miszczyszyn on Writing a Book About TypeScript

Written by Thomas De Moor | Jan 28, 2021 5:00:00 AM

Michał Miszczyszyn is a Tech Lead for X-Team. He's an active blogger, speaker, and now an author too. Michał recently wrote and published a book about TypeScript. In this interview, we talk about what inspired him to write a programming book, how the book is structured, and what the process of writing the book was like.

(cover picture from SowaProgramuje)

Why did you decide to write a book about TypeScript? How did you figure out people wanted such a book?

In the past, I've created a few developer-oriented groups on Facebook and Discord. In those groups, I noticed people asking the same TypeScript questions over and over again. I tried answering them, but the questions just kept coming back. That's what inspired me to answer those questions in one big document.

At first, I thought it could fit in a blog post, but I eventually realized it could easily become an ebook. And here we are, a year and 350 pages later there's a printed book.

The cover of my book

Why did you decide to write the book in Polish?

A few reasons. Firstly, Polish developers know me. I have a Polish blog and a huge community around it. Secondly, it was much easier to write the book in Polish and go through the entire process in Poland, particularly for the VAT MOSS taxes, which are honestly a bit of a pain in the neck.

Thirdly, I wanted to sell a printed book. It's just not feasible for one person to ship books worldwide, especially during this pandemic. This begin said, I plan to release an English ebook eventually.

Tell us about your book. Who is it primarily for and what is it structured like?

The structure of the book makes it perfect for junior, mid, and senior developers. Don't just take my word for it. There are many reviews online that seem to confirm this! The book starts with a foreword and an introduction. Then I discuss words such as "JavaScript" and "TypeScript" in the Polish language.

I wanted to make it grammatically correct without sounding like a total jerk using English words in a Polish book, so I paid for advice at the Polish Language Counseling PWN.

Then, there's a quick summary of ECMAScript features that are not TypeScript features per se. Then there's a tutorial: setting up a project, basic types, functions, classes, etc. Anything you need to learn TypeScript from the grounds up – it's there.

The second part of the book (chapters 10–21) is geared toward more experienced developers. It starts with types compatibility, covariancy, contravariancy, and similar difficult words that I try to explain simply without going too much into their theoretical backgrounds.

The chapters after that are based on my real-life, commercial experience with TypeScript and the problems I had to solve with it. So we have an approach to nominal typing in TS, conditional types in practice, and creating your own typesafe validators. I also included a few chapters about migrating from JavaScript to TypeScript and creating types for existing libraries written in pure JS.

What was the process of writing the book like? How did you figure out what to include and what not to include?

I'm a developer writing a book, so the book is written in Markdown and files are kept on GitHub. When I commit and push any changes, my GitHub Actions workflow pulls them and builds three ebooks – pdf, epub, and mobi – which it stores as a GitHub release. I automated the whole process to keep track of changes and share the book's latest version with my friends.

The creative part of writing the book was a bit of a cliché. I wrote when I was in the right mood. It was a hobby project which I did when I wasn't working with X-Team. The book includes what I think is important, what other people have asked me about, and what I had problems with in the past. In my opinion, that's what makes the book so useful: it's my hands-on experience with TypeScript.

Turns out that writing a book takes up a lot of space in your home

What has been a challenge about the book that you hadn't expected?

Actually, the biggest challenge was setting up an ecommerce shop. I was surprised by how hard that was! Especially when it comes to rounding, taxes, discounts, etc. I only have three products in my store and it took hours to configure and test everything properly. Nightmare!

Do you plan to write more books like this? Will you write a "sequel"?

It's unlikely I'll write another book, but you never know. My next big project will definitely be my YouTube debut. I'll keep you posted!

Sounds good! Thank you for your time and best of luck with your future writing (and YouTube?!) career.