Typescript

TypeScript Skill References

Detailed guides for utility types, generics, type guards, configuration, and error handling

Overview

This directory contains detailed guides for advanced TypeScript features. Main SKILL.md provides critical patterns. These references offer deep-dives into utility types, advanced generics, and type-safe patterns.


Quick Navigation

ReferencePurposeRead When
utility-types.md30+ built-in utility types (Partial, Pick, etc.)Transforming types, avoiding manual definitions
generics-advanced.mdConstraints, conditional types, mapped typesBuilding reusable type-safe components
type-guards.mdType narrowing, discriminated unionsRuntime type checking and validation
config-patterns.mdtsconfig.json deep dive, strict modeSetting up TypeScript projects
error-handling.mdType-safe error patterns, Result typesHandling errors without exceptions
ts5-patterns.mdNoInfer, branded types, exhaustive switch, using, const type parametersUsing TypeScript 5.x features

Reading Strategy

For Type Transformations

  1. Read main SKILL.md
  2. MUST read: utility-types.md for Partial, Pick, Omit, Record, etc.

For Generic Functions/Components

  1. Read main SKILL.md
  2. MUST read: generics-advanced.md for constraints and conditional types

For Runtime Validation

  1. Read main SKILL.md
  2. MUST read: type-guards.md for type narrowing patterns

For Project Setup

  1. Read main SKILL.md
  2. MUST read: config-patterns.md for strict mode and compiler options

File Descriptions

utility-types.md

Complete guide to 30+ built-in utility types

  • Partial, Required, Readonly
  • Pick, Omit, Exclude, Extract
  • Record, NonNullable, ReturnType
  • Parameters, ConstructorParameters
  • And 20+ more with examples

generics-advanced.md

Advanced generic patterns

  • Generic constraints
  • Conditional types
  • Mapped types
  • Template literal types
  • Infer keyword

type-guards.md

Type narrowing and validation

  • typeof, instanceof guards
  • User-defined type guards
  • Discriminated unions
  • Assertion functions

config-patterns.md

tsconfig.json configuration

  • Strict mode options
  • Module resolution
  • Path mapping
  • Project references

error-handling.md

Type-safe error patterns

  • Result types
  • never type
  • Error unions
  • Exception handling

ts5-patterns.md

TypeScript 5.x language features

  • NoInfer<T> — prevent unintended type inference (TS 5.4)
  • Branded/nominal types — type-safe IDs and domain values
  • Exhaustive switch with never and assertNever helper
  • using / await using — explicit resource management (TS 5.2)
  • Const type parameters — preserve literal types in generics (TS 5.0)

Cross-Reference Map