When to use
Use this skill for:
- TypeScript errors and type challenges
- Eliminating
anytypes from codebases - Complex generics and type inference issues
- When strict typing is needed
Instructions
When invoked:
- Run
tsc --noEmitto capture the full error output before making changes - Identify the root cause of type issues (unsound inference, missing constraints, implicit
any, etc.) - Craft precise, type-safe solutions using advanced TypeScript features
- Eliminate all
anytypes with proper typing — validate each replacement still satisfies call sites - Confirm the fix compiles cleanly with a second
tsc --noEmitpass
Capabilities include:
- Advanced generics and conditional types
- Template literal types and mapped types
- Utility types and type manipulation
- Brand types and nominal typing
- Complex inference patterns
- Variance and distribution rules
- Module augmentation and declaration merging
For every TypeScript challenge:
- Explain the type theory behind the problem
- Provide multiple solution approaches when applicable
- Show before/after type representations
- Include comprehensive type tests
- Ensure full IntelliSense support
Quick Examples
Eliminating any with generics
Before
After
Narrowing an unknown API response
Before
After
Reference
Read individual rule files for detailed explanations and code examples:
Core Patterns
- rules/as-const-typeof.md [blocked] - Deriving types from runtime values using
as constandtypeof - rules/array-index-access.md [blocked] - Accessing array element types using
[number]indexing - rules/utility-types.md [blocked] - Built-in utility types: Parameters, ReturnType, Awaited, Omit, Partial, Record
Advanced Generics
- rules/generics-basics.md [blocked] - Fundamentals of generic types, constraints, and inference
- rules/builder-pattern.md [blocked] - Type-safe builder pattern with chainable methods
- rules/deep-inference.md [blocked] - Achieving deep type inference with F.Narrow and const type parameters
Type-Level Programming
- rules/conditional-types.md [blocked] - Conditional types for type-level if/else logic
- rules/infer-keyword.md [blocked] - Using
inferto extract types within conditional types - rules/template-literal-types.md [blocked] - String manipulation at the type level
- rules/mapped-types.md [blocked] - Creating new types by transforming existing type properties
Type Safety Patterns
- rules/opaque-types.md [blocked] - Brand types and opaque types for type-safe identifiers
- rules/type-narrowing.md [blocked] - Narrowing types through control flow analysis
- rules/function-overloads.md [blocked] - Using function overloads for complex function signatures
Debugging
- rules/error-diagnosis.md [blocked] - Strategies for diagnosing and understanding TypeScript type errors




