Learning TypeScript

| View comments on Hacker News

TypeScript is one of my favorite languages. It is fast, portable, has a great ecosystem, and the language itself is pleasant to work with. It has flaws, but I cannot think of a more versatile language. With TypeScript (and JavaScript), you can write:

  • Web applications
  • iOS/Android mobile apps
  • macOS/Windows/Linux desktop apps
  • Scripts
  • Backends
  • Games

I can’t think of another language so omni-present today. In a way, it’s like C. JavaScript, like C, can run anywhere since every platform has a web browser.

I’ve spent a lot of time becoming better at TypeScript, so I thought I’d compile and share some resources that have helped me over the years.

Unfortunately, TypeScript is complex. First, since it compiles to JavaScript, you need to learn that first. If you’re planning on writing frontend applications you’ll need to also learn HTML/CSS and Browser/DOM APIs. For backend you’ll need to understand NodeJS (or Bun/Deno).

Learning JavaScript is a pretty difficult task, even if you’re an experienced programmer. It has a strange inheritance model, it’s single-threaded, and the ecosystem evolves very quickly. I found the following to help me gain a better understanding of JavaScript:

Now, onto TypeScript! There are two things to look at: programming with TypeScript, and writing type-level TypeScript.

Reading through the TypeScript Handbook helped me understand the core features of the language.

The more difficult part is type-level TypeScript. This refers to writing programs in the type system to generate other types. This is where the strenght of TypeScript lies, since it allows you to precisely express the types of your program. Type-level TypeScript is also a large part of what made the language successful, since it allowed complex, dynamic, JavaScript types to be represented accurately.

The TypeScript Handbook has a section on type-level programming. This is a great reference, but I found the Type-Level TypeScript course to be the best resource. Matt Pocock, who is well-known in the TypeScript world, also has a series called Total TypeScript. I’m sure it’s execellent, but it costs hundreds of dollars, so it’s hard for me to recommend.

For additional challenges I’ve found Type Challenges to be excellent, especially with the VS Code extension.

Additional Resources

  • TypeScript on Exercism
  • Effective TypeScript
  • Runtimes:
    • Deno: Run TypeScript without compiling!
    • Bun: Similar to Deno. Also excellent.
  • Cool libraries:
    • Zod: Validate TypeScript types at runtime
    • ts-pattern: Pattern-matching for TypeScript
    • Astro: Tool that excells at static site generation with amazing TypeScript support
    • Remeda: Lodash for TypeScript
    • XState: Over-complicated state machines in TypeScript

Recent posts from blogs that I like

FBI Seizes NetNut Proxy Platform, Popa Botnet

The Federal Bureau of Investigation (FBI) said today it worked with industry partners to seize hundreds of domains associated with NetNut, a sprawling residential proxy service operated by the publicly-traded Israeli company Alarum Technologies [NASDAQ: ALAR]. The action comes roughly two weeks afte...

via Krebs on Security

Brushstrokes: Portraits 1760-1877

Brushstrokes and painterly marks in the portraits of Gainsborough, Reynolds, Angelica Kauffmann, Jacques-Louis David and James Tissot.

via The Eclectic Light Company

Text AI watermarks will always be trivial to remove

The European Union AI Act will begin to be enforceable in August 2026, one month from now1. One of the biggest new requirements is Article 50, which requires all AI outputs to be “detectable as artificially generated”. In other words, if LLM providers want to do business in the EU, they will have to...

via Sean Goedecke