TypeScript tutorials
41 articles · page 2 of 3Hand-written tutorials, ordered as a recommended learning path.
- 21 Discriminated Unions Model application states, async flows, and finite state machines with discriminated unions and exhaustive pattern matching.
- 22 Module Augmentation Extend third-party modules, merge interfaces, and augment global types without modifying source code using declaration merging.
- 23 satisfies Operator Learn how the satisfies operator validates types without widening, preserving literal inference for config objects and lookup tables.
- 24 Template Literal Types Master template literal types to build type-safe string patterns for routes, events, CSS values, and API endpoints in TypeScript.
- 25 Type Predicates Write type predicate functions to narrow unions, filter arrays, and validate unknown data with full type safety.
- 26 using & Disposable Learn TypeScript's using keyword for automatic resource cleanup with the Disposable and AsyncDisposable interfaces.
- 27 Variance Annotations Understand covariance, contravariance, and how TypeScript's in and out annotations make generic type relationships explicit.
- 28 Generics Deep Dive Go beyond basic generics — constraints, conditional types, mapped types, infer, and real-world patterns for writing type-safe reusable code.
- 29 Conditional Types Learn conditional types in TypeScript: distribution, infer, and how to build expressive utility types that adapt to the input shape.
- 30 Enums vs Unions Compare TypeScript enums with string union literals. Learn the trade-offs in runtime cost, exhaustiveness, ergonomics, and when each is the right choice.
- 31 Generics + React A practical guide to using TypeScript generics in React components, hooks, and props for safer, more reusable building blocks.
- 32 infer Keyword Master the infer keyword in TypeScript conditional types. Learn how to extract parts of complex types, build utility helpers, and write expressive generics.
- 33 Mapped Types A practical tour of mapped types in TypeScript, including key remapping, modifiers, and patterns that build powerful generic utilities.
- 34 Narrowing Learn how TypeScript narrows types through control flow, using typeof, instanceof, in, and discriminated unions to write safer code.
- 35 Recursive Types Build recursive types in TypeScript: deep readonly, JSON, paths, and tuple manipulation. Learn how to write recursion that the compiler can actually evaluate.
- 36 Strict Mode Understand what strict mode actually turns on, which extra flags are worth enabling, and how to adopt strictness incrementally.
- 37 Type Guards Master TypeScript type guards: typeof, instanceof, discriminated unions, user-defined predicates, and assertion functions. Narrow types safely and idiomatically.
- 38 Utility Types A practical reference for TypeScript utility types: Partial, Pick, Omit, Record, Readonly, ReturnType, and a dozen more with real examples.
- 39 Zod Validation Use Zod with TypeScript to validate runtime data and infer types from a single source of truth. Cover schemas, parsing, transforms, and error handling.
- 40 Branded Types Add nominal typing to TypeScript using branded types so you cannot accidentally mix UserId, OrderId, raw strings, or money values.