Jump to content

TypeScript

Build safety nets, not guard rails

Avatar of @t3dotgg

Whether you’re a new or seasoned developer, we think that TypeScript is a must have. It can look intimidating at first, but much like a lot of tools, is something that many never look back from after starting to use it.

It provides live feedback as you write your code by defining expected data types, and either provides helpful autocomplete in your code editor, or yells at you with red squiggly lines if you’re trying to access a property that doesn’t exist, or you’re trying to pass a value of the wrong type.

It is, perhaps, the tool that provides the most productivity to developers; providing documentation of the code you’re writing or consuming directly in your editor, and having instant feedback as you inevitably make mistakes is absolutely priceless.

Type Inference

Despite most guides go into depth on writing TypeScript, for the most part, developers benefit the most from the type inference it provides. There is a ton of work that library maintainers do when providing types for their library, but means we as developers can benefit from the type inference - and almost provide a documentation platform within your code editor.

You might be using TypeScript wrong...

Watch Theo's overview on Youtube here

Powerful uses of type inference

Zod

Zod is a schema validation library that is built on top of TypeScript. Write a source of truth for your data, and Zod will ensure that your data is valid throughout your application.

Tanstack Query

Tanstack Query gives you declarative, always-up-to-date auto-managed queries and mutations that directly improve both your developer and user experiences.

Useful Resources

ResourceLink
TypeScript Handbookhttps://www.typescriptlang.org/docs/handbook/
Beginners TypeScript Tutorialhttps://github.com/total-typescript/beginners-typescript-tutorial
Type Challengeshttps://github.com/type-challenges/type-challenges
Rodney Mullen of TypeScript (Matt Pocock) Youtube Channelhttps://www.youtube.com/c/MattPocockUk/videos