TypeScript’s <> angle brackets used to strike fear into my heart on a daily basis, even though I thought I understood the concept of a “generic type.”
Now that I understand <> angle brackets have the power to slay the monster of any types in my code, I find them indispensable! 🥳 Industrial Bracket
TypeScript’s <> angle brackets indicate generic TypeScript types, which allow you to create reusable “types within types” that wrap other types. They allow you to extend a type to work with any data type, without any.
Generics gives you a level of flexibility that is difficult to achieve without using them, especially if you (like me) love React Hooks and React Query.
This article will explain why I love TypeScript’s generics and why you should use them in your codebase, at least if you’re aiming for type safety.
We’re going to work through some practical examples, with an emphasis on insights from my own experience as a…
Guide Rail Joint Plate Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.