typescript-advanced

Installation
SKILL.md

Advanced TypeScript — Type-Level Mastery


Mandatory Pre-Flight Context Inspection

Before writing complex TypeScript types or library abstractions, you MUST inspect:

  1. Zero as any Cast Rule (Section 15) → Fix the underlying type signature or use unknown with a type guard; ban as any
  2. Discriminated Unions for State Machine Modeling (Section 62) → Model multi-state objects with tagged discriminated unions for compile-time exhaustive checks
  3. The satisfies Operator vs Type Assertion (Section 193) → Use satisfies to validate types without widening object literals
  4. Compiler Memory & Type Instantiation Limits → Avoid recursive conditional types deeper than 5 levels; prefer interface extension over deep & intersections
  5. TS 5.5+ Inferred Type Predicates → Leverage native type narrowing in .filter() without manual x is T boilerplate where possible

Activation Boundaries

  • Activate when: Designing type-safe library APIs, generic utility types, discriminated union state machines, and resolving complex TypeScript compiler errors.
  • DO NOT activate when: Writing pure runtime JavaScript without TypeScript, or basic application components with trivial props.
Installs
3
GitHub Stars
7
First Seen
Apr 26, 2026