TT.TotalTypeScript

  • Pro Workshops
  • Free Tutorials
  • Tips
  • Articles

TypeScript Articles by Matt Pocock

Structure of a TypeScript Error

Understand why TypeScript throws complicated errors by learning how to read them. Errors mirror the structure of the code being compared and can be simplified by changing the way types are assigned.

Matt Pocock
Matt Pocock

Mental Model for TypeScript Generics

Learn how to use TypeScript generics on the type level and with functions to improve code readability, type safety, and reduce repetitive code. Use "type helpers" to create new types and generic functions to pass in and return specific types.

Matt Pocock
Matt Pocock

When should you use Zod?

Use Zod to validate unknown inputs in your app, whether it's a CLI or a public API, to ensure that data entering your app is safe. Zod can also be used for 'sort of' trusted inputs, like third-party services, to ensure that the data returned is what you expect.

Matt Pocock
Matt Pocock

Writing string.replace in TypeScript

TypeScript's template literal syntax allows developers to manipulate and transform strings in a powerful way. This can be extended using unions, infer, and recursion to handle more complex tasks.

Matt Pocock
Matt Pocock

Rewriting TypeScript in Rust? You'd have to be...

Donny (kdy1 on GitHub) is rewriting TypeScript in Rust hoping to speed up tsc which is slow due to its TypeScript base. In this interview, he explains some of the financial and technical challenges they face with this open-source project.

Matt Pocock
Matt Pocock

Don't use Function type in TypeScript

Matt Pocock
Matt Pocock