Agent skill · software engineering · wshobson

typescript-advanced-types

Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

Why this skill is useful

Provides advanced TypeScript patterns and techniques that enhance type safety and code reusability, which the AI may not generate on its own.

What it needs

About 5k tokens when loaded. Last updated 2026-08-05. 38,570 stars on the source repository.

What this skill does

TypeScript Advanced Types Comprehensive guidance for mastering TypeScript's advanced type system including generics, conditional types, mapped types, template literal types, and utility types for building robust, type-safe applications. When to Use This Skill Building type-safe libraries or frameworks Creating reusable generic components Implementing complex type inference logic Designing type-safe API clients Building form validation systems Creating strongly-typed configuration objects Implementing type-safe state management Migrating JavaScript codebases to TypeScript Core Concepts 1. Generics Purpose: Create reusable, type-flexible components while maintaining type safety. Basic Generic Function: Generic Constraints: Multiple Type Parameters: 2. Conditional Types Purpose: Create types that depend on conditions, enabling sophisticated type logic. Basic Conditional Type: Extracting Return Types: Distributive Conditional Types: Nested Conditions: 3. Mapped Types Purpose: Transform existing types by iterating over their properties. Basic Mapped Type: Optional Properties: Key Remapping: Filtering Properties: 4. Template Literal Types Purpose: Create string-based types with pattern matching and transformation. Basic Template Literal: String Manipulation: Path Building: 5. Utility Types Built-in Utility Types: Detailed worked examples and patterns Detailed sections (starting with ## Advanced Patterns) live in references/details.md. Read that file when the navigation summary above is insufficient. Best Practices 1. Use unknown over any: Enforce type checking 2. Prefer interface for object shapes: Better error messages 3. Use type for unions and complex types: More flexible 4. Leverage type inference: Let TypeScript infer when possible 5. Create helper types: Build reusable type utilities 6. Use const assertions: Preserve literal types 7. Avoid type assertions: Use type guards instead 8. Document complex types: Add JSDoc comments 9. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills wshobson/typescript-advanced-types

View the source on GitHub

Browse the @skills marketplace