Logo

BLOG

Read thoughts on software development, design, and engineering.

⌘K
Loading posts…

Popular Articles

The any, unknown, and never TypesTypeScript15 min read

The any, unknown, and never Types

TypeScript has three special types that handle edge cases: any (the escape hatch), unknown (the type-safe alternative), and never (for impossible values). Understanding when and how to use these types is crucial for writing safe yet flexible TypeScript code. This guide covers the differences between these types, shows you how to work with unknown safely, and demonstrates how never enables exhaustive type checking and prevents runtime errors. Learn to use these types effectively while maintaining type safety.

#TypeScript#Type System#any type+4
Read article
Enums: When and How to Use ThemTypeScript11 min read

Enums: When and How to Use Them

Enums provide a way to define named constants in TypeScript, making your code more readable and maintainable. Whether you're working with status codes, user roles, or application states, enums help organize related values under a single type. This guide covers numeric enums, string enums, const enums, and most importantly—when to use enums versus alternatives like union types and objects. Learn the patterns that will make your TypeScript code cleaner and more expressive.

#TypeScript#Enums#Type System+4
Read article
Working with Arrays and TuplesTypeScript14 min read

Working with Arrays and Tuples

Arrays and tuples are essential for working with collections in TypeScript. While arrays hold multiple values of the same type, tuples allow you to work with fixed-length arrays where each position has a specific type. This guide covers array types, readonly patterns, tuple best practices, and practical examples that you'll use in real applications. Learn how to leverage TypeScript's type system for safer, more maintainable collection handling.

#TypeScript#Arrays#Tuples+4
Read article
Blog — All posts | Joshua R. Lehman Portfolio Site | Joshua R. Lehman Portfolio