·type-narrowing

Use when working with union types. Use when handling nullable values. Use when TypeScript says a value might be undefined. Use when working with discriminated unions.

0Installs·0Trend·@marius-townhouse

Installation

$npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill type-narrowing

SKILL.md

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.

If you're using as Type inside an if block, you can probably narrow instead.

Use when working with union types. Use when handling nullable values. Use when TypeScript says a value might be undefined. Use when working with discriminated unions. Source: marius-townhouse/effective-typescript-skills.

View raw

Facts (cite-ready)

Stable fields and commands for AI/search citations.

Install command
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill type-narrowing
Category
</>Dev Tools
Verified
First Seen
2026-02-05
Updated
2026-02-18

Quick answers

What is type-narrowing?

Use when working with union types. Use when handling nullable values. Use when TypeScript says a value might be undefined. Use when working with discriminated unions. Source: marius-townhouse/effective-typescript-skills.

How do I install type-narrowing?

Open your terminal or command line tool (Terminal, iTerm, Windows Terminal, etc.) Copy and run this command: npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill type-narrowing Once installed, the skill will be automatically configured in your AI coding environment and ready to use in Claude Code or Cursor

Where is the source repository?

https://github.com/marius-townhouse/effective-typescript-skills