typescript-advanced-types

Design and validate advanced TypeScript types for compile-time safety.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Jhabbig/Habbig --skill typescript-advanced-types-jhabbig
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-advanced-types
Source: https://github.com/Jhabbig/Habbig/tree/main/.claude/plugins/wshobson/javascript-typescript/skills/typescript-advanced-types
Command: npx skills add https://github.com/Jhabbig/Habbig --skill typescript-advanced-types-jhabbig

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design, understand, and troubleshoot advanced TypeScript types when simple annotations are not enough. It reduces type errors by turning complex compile-time logic into reusable patterns you can apply across a codebase.

Core Features & Use Cases

  • Build generic utilities that infer and transform types safely.
  • Model conditional, mapped, template literal, and utility types for real application logic.
  • Create type-safe APIs, event emitters, builders, validators, and state machines.
  • Use it when refactoring JavaScript to TypeScript, tightening public interfaces, or debugging tricky type inference issues.

Quick Start

Ask for help analyzing a TypeScript type problem, and include the relevant type definitions plus the behavior you want.

Frequently Asked Questions about typescript-advanced-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create type-safe generic utilities in TypeScript?

Type-safe generic utilities are built using TypeScript conditional types, mapped types, and type inference to transform types at compile time. This approach applies reusable patterns for API clients, form validators, and state machines by enforcing strict type checking without runtime overhead.

How do I use template literal types to build strict type-safe APIs?

Template literal types enable strict type-safe APIs by modeling string patterns like event names and route paths at compile time. Combining template literal types with mapped types and type inference ensures that API clients and builders reject invalid string inputs during compilation.

What's the best way to model a discriminated union for a state machine in TypeScript?

Modeling discriminated unions for state machines is best achieved by defining conditional types and mapped types that validate state transitions at compile time. This approach ensures only valid state transitions are accepted, reducing runtime errors in builders and event emitters.

Why does TypeScript type inference fail on my deeply transformed generic types?

TypeScript type inference fails on deeply transformed generic types when conditional types lack sufficient infer extraction points. Debugging requires restructuring mapped types and conditional types to provide explicit type inference paths, ensuring the compiler resolves complex type transformations.

Do I need advanced TypeScript types when refactoring a JavaScript codebase?

Advanced TypeScript types are needed during JavaScript refactoring when simple annotations cannot capture complex application logic. Implementing conditional types, template literal types, and discriminated unions tightens public interfaces and catches structural errors early in the migration process.

Can I extract specific properties from an existing type using TypeScript conditional types?

You can extract specific properties from an existing type using TypeScript conditional types with the infer keyword. This infer-based extraction technique creates reusable utility types that pull, transform, or filter deep type structures for type-safe application patterns.