type-narrowing

Installation
SKILL.md

Understand Type Narrowing

Overview

Type narrowing is the process by which TypeScript refines a type from broad to more specific based on control flow.

Master narrowing to write cleaner code without type assertions, and to help TypeScript understand your logic.

When to Use This Skill

  • Working with Type | null or Type | undefined
  • Handling union types like string | number
  • Processing discriminated unions (tagged unions)
  • Getting "possibly undefined" errors
  • Avoiding type assertions in conditionals

The Iron Rule

Installs
14
GitHub Stars
2
First Seen
Feb 3, 2026
type-narrowing — marius-townhouse/effective-typescript-skills