TypeScript

Creating new TypeScript types using template literal types

Creating new TypeScript types using template literal types

  • February 5, 2024

TypeScript is way more powerful than I give it credit for. I recently learned about creating new TypeScript types using template literal types, and I was pretty surprised to know that TypeScript can do that. Let us assume we wanted to create a type for the CSS properties margin and...

React TypeScript: Simplify Imports with Path Aliases

React TypeScript: Simplify Imports with Path Aliases

  • January 27, 2024

As codebases grow larger and more complex in structure, imports can become unmanageable. As more directories are added, imports become intricately long and obscure clarity. Fortunately, we can simplify imports with path aliases. The problem The following is a fairly common occurrence in a large project: This can be burdensome...

Using utility types for transforming TypeScript types

Using utility types for transforming TypeScript types

  • May 20, 2021

TypeScript provides some built-in utility types that help facilitate transformations of types from one form to another. These utilities are available globally. They can be quite handy in various situations. TypeScript generics Before understanding the TypeScript utility types, it is important to understand type aliases and generics. You can create...

TypeScript: the difference between interface and type

TypeScript: the difference between interface and type

  • May 13, 2021

Once we start exploring TypeScript, we start using interfaces and types without really understanding the differences between them. I am guilty of doing that as well. It is simple to get started with them and keep using them. But, at some point, it becomes important to know the difference between...

How to setup GatsbyJS starter with TypeScript and ESLint

How to setup GatsbyJS starter with TypeScript and ESLint

  • May 10, 2020

Gatsby has become fairly popular in the last couple of years and it has starting becoming the go to static site generator for a lot of projects. The smooth developer experience and the warm community has enriched the adoption even more. TypeScript has had a similar growth curve and has...