Struggling with TypeScript: why not?

One of your biggest skills as a person-on-the-internet is your ability to research and learn new things.

When we started Craftwork, I had never used TypeScript before. I spent years building with good old fashioned JavaScript, and really loved it.

I could build prototypes quickly, change my strategy on the fly, and make new features fly together without much thought.

But... it was also a bit of a mess. Because JavaScript has many weird quirks and "features", writing robust javascript code requires lots of discipline and experience. I certainly had some of both, but I knew from the onset that Craftwork would be a big project, and I wanted to make sure that I could build it in a way that would be maintainable and scalable.

I would be building an engineering team, and I wanted to make sure that they could hit the ground running. Using TypeScript as the de facto language for Craftwork was a no-brainer.

JavaScript is weird.

When I say "JavaScript has many weird quirks and features", this is what I mean:

1
'b' + 'a' + + 'a' + 'a' // 'baNaNa'

If you're not a developer, you might be thinking "what the hell is that?"

Me too, friend.

There's plenty more adorable gotchas, and they're all fun and games until you're debugging a production issue at 3am.

Building a product is hard enough without having to worry about whether NaN === NaN (it doesn't) or why [] + [] is an empty string.

Duck Hunt Dog laughing
Math? Check.

Time to TypeScript

So, it was time to dive in to TypeScript. TypeScript is a superset of JavaScript that adds static types to the language. This means that you can catch many bugs before they happen, and you can write more robust code.

Even still, when I started learning TypeScript, I did not have a great time.

There's a real learning curve to TypeScript - it is notoriously picky, and it can be hard to get started. I spent hours trying to figure out how to make TypeScript happy, and I spent even more hours trying to figure out why TypeScript was unhappy.

The truth is, I spent a ton of time fighting the type system. I spent hours trying to figure out how to make TypeScript happy, and I spent even more hours trying to figure out why TypeScript was unhappy.

Eventually (after a few months, in my case), everything started to click. I got used to the error messages, and I was making my way through features more and more quickly.

Learning to learn is the whole thing

I won't bore you with how-good-I-am-at-TypeScript - that's not important. What is important is that I learned how to learn TypeScript. I learned how to research, how to ask questions, and how to find the answers I needed.

In my case, it was a mix of things: YouTube tutorials, blog posts, TypeScript documentation, and a network of mega-smart dev pals who I could ask for help when I was really stuck.

The best thing about being a person-on-the-internet is the ability to research and learn new things. If you can do that, you can do anything.

...which is a damn good thing, because like 3 weeks after I got comfortable with TypeScript, we started building Craftwork's core operating system with Ruby On Rails. 😅

Keep learning

One of my biggest fears is becoming out of touch and irrelevant. I feel pretty strongly that when you stop learning things, everything starts to decline.

Keep learning, my friends. Keep pushing yourself to learn new things, and keep pushing yourself to learn hard things.

Great resources for learning TypeScript

It's Matt Pocock. He is the educator for TypeScript. His YouTube Channel @mattpocockuk is absolutely loaded with TypeScript tutorials, and he's a great teacher.

This dispatch of Tiny Improvements is inspired by (and not sponsored by) Matt's work - I owe a lot of my TypeScript knowledge to him, and if you're looking to learn TypeScript, I can't recommend his channel enough.

This week, Matt Launched:

There's a video on his channel describing the whole launch, and it's worth a watch.

I love Matt's work - it's world-class stuff, and they the extra mile to offer Purchasing Power Parity - the price of his paid content scales to your local currency, which is a really nice touch.

What are you learning?

I'd love to hear what you're learning these days, whether it's technical, non-technical, or somewhere in between. Hit reply and drop me a line via email, or shout at me on Threads @irreverentmike.

***
Mike Bifulco headshot

💌 Tiny Improvements Newsletter

Subscribe and join 🔥 981 other builders

My weekly newsletter for product builders. It's a single, tiny idea to help you build better products.

    Once a week, straight from me to you. 😘 Unsubscribe anytime.


    Get in touch to → Sponsor Tiny Improvements