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:
- Zero
as anyCast Rule (Section 15) → Fix the underlying type signature or useunknownwith a type guard; banas any - Discriminated Unions for State Machine Modeling (Section 62) → Model multi-state objects with tagged discriminated unions for compile-time exhaustive checks
- The
satisfiesOperator vs Type Assertion (Section 193) → Usesatisfiesto validate types without widening object literals - Compiler Memory & Type Instantiation Limits → Avoid recursive conditional types deeper than 5 levels; prefer interface extension over deep
&intersections - TS 5.5+ Inferred Type Predicates → Leverage native type narrowing in
.filter()without manualx is Tboilerplate 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.