Skip to content

TypeScript Essentials

Type safety for production codebases. Structural typing, interfaces, unions, generics, utility types, and configuring TypeScript for maximum value.

1
Why TypeScript and Structural Typing
intermediate

Why TypeScript exists, how structural typing differs from nominal typing, and why duck typing is the foundation of the entire type system. The mental model that prevents 90% of TS confusion.

11 min read
2
Basic Types and Type Annotations
intermediate

TypeScript's primitive types, arrays, objects, function signatures, and the type inference engine that means you rarely need to write types manually. How to annotate when you should and trust inference when you shouldn't.

11 min read
3
Interfaces vs Type Aliases
intermediate

When to use interface, when to use type, how extends differs from intersection, and the declaration merging behavior that makes interfaces uniquely powerful for library authors.

10 min read
4
Union Types and Discriminated Unions
intermediate

Union types for values that can be multiple types, discriminated unions for modeling state machines, and the narrowing patterns that make TypeScript's type system genuinely powerful.

12 min read
5
Literal Types and Narrowing
intermediate

How TypeScript tracks exact values through literal types, narrows unions via control flow analysis, and the const assertion that unlocks type-level string manipulation.

11 min read
6
Generics and Constraints
intermediate

Generic functions and types that work with any shape while staying type-safe. Constraints with extends, default type parameters, and the patterns that make libraries like React and Zod possible.

10 min read
7
Conditional and Mapped Types
intermediate

Type-level if/else with conditional types, transforming object types with mapped types, and the keyof/in operators that make TypeScript's type system Turing-complete.

12 min read
8
Utility Types from Scratch
intermediate

Build Partial, Required, Pick, Omit, Record, Exclude, Extract, ReturnType, and Parameters from primitives. Understanding the internals eliminates the mystery.

12 min read
9
Type Guards and Assertion Functions
intermediate

Custom type predicates with the is keyword, assertion functions with asserts, user-defined narrowing, and exhaustive pattern matching with never.

11 min read
10
TypeScript Configuration and Strict Mode
intermediate

Every tsconfig strict flag explained with real examples of bugs each one catches. Why strict: true is non-negotiable in production, and the flags that matter beyond strict.

12 min read
11
Quiz: Type or Error?
intermediate

10 TypeScript snippets — predict whether each one compiles or produces a type error. Trace the type system step by step. Scoring above 8 means you've internalized TypeScript's rules.

8 min read