#typescript

5 posts

Everything You Need To Know About TypeScript Union Types

Union types are a powerful feature of TypeScript to ergonomically model a finite number of mutually exclusive cases and ensure that every case is handled safely.

How To Do Anything in TypeScript With Type Guards

Type guards are conditional checks that allow types to be narrowed from general types to more specific ones. With type guards, we do run-time type checking and ensure that code is safe.

How to Power Up the React Context API with TypeScript

Context is a simple, but powerful feature that can be used in any React project. Using Context we can solve issues with prop drilling, and then by adding TypeScript, we can dramatically improve safety when using a context.

How to Delete Dead Code in TypeScript Projects

Deleting dead code is a worthwhile effort that reduces the amount of that code that has to be downloaded, compiled, and maintained. Using automated tools, we can simplify the process of identifying dead code and removing it.

Performing Surgery on Types with Modify

The Modify type can be used to replace properties in types, which can be useful when working with libraries that have non-generic types.