typescript-advanced-types

Implements generics, conditional types, mapped types, and template literal types in TypeScript.

2|Updated Feb 15, 2026
One-click install
npx skills add https://github.com/SkinnnyJay/simpill-utils --skill typescript-advanced-types-skinnnyjay
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript-advanced-types
Source: https://github.com/SkinnnyJay/simpill-utils/tree/main/.agents/skills/typescript-advanced-types
Command: npx skills add https://github.com/SkinnnyJay/simpill-utils --skill typescript-advanced-types-skinnnyjay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing type-safe TypeScript code for complex scenarios like API clients, event emitters, and form validators requires deep knowledge of generics, conditional types, and mapped types that many developers lack. ## Core Features & Use Cases - Advanced Type Patterns: Provides working implementations of generics, conditional types, mapped types, template literal types, and utility types. - Real-World Patterns: Includes type-safe event emitters, API clients, builder patterns, deep readonly/partial types, form validation, and discriminated unions. - Type Inference Techniques: Covers the infer keyword, type guards, assertion functions, and type testing helpers. - Use Case: When building a typed API client where request parameters and response types must be inferred from an endpoint configuration map, apply the ExtractParams/ExtractBody/ExtractResponse conditional type patterns. ## Quick Start Ask the AI to help you implement a type-safe event emitter or API client in TypeScript using generics and conditional types.

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 a type-safe event emitter in TypeScript?▼

Define an event map type mapping event names to payload types, then use generics with mapped types to type the on and emit methods. The compiler enforces that emitted data matches the declared payload for each event name.

How to extract return types and parameters from functions in TypeScript?▼

Use conditional types with the infer keyword, such as T extends (...args: infer P) => infer R. TypeScript also provides built-in ReturnType and Parameters utility types for common extraction cases.

What is the difference between mapped types and conditional types?▼

Mapped types iterate over an existing type's properties to transform them, like Partial or Readonly. Conditional types select a type based on a condition using extends, enabling logic like extracting types or distributing over unions.

When should I use unknown instead of any in TypeScript?▼

Use unknown for values whose type is not yet determined, since it forces type narrowing through guards before use. Unlike any, unknown preserves type safety and prevents accidental operations on unchecked values.

Why do deeply nested conditional types slow down TypeScript compilation?▼

Each conditional branch forces the compiler to evaluate type relationships recursively, and deeply nested or recursive types multiply this work exponentially. Cache complex type computations in named aliases and limit recursion depth to reduce compile times.

How do discriminated unions improve type narrowing in TypeScript?▼

Discriminated unions use a shared literal field like status or type so switch statements narrow each branch to the exact variant. This gives full autocomplete and compile-time exhaustiveness checking without manual type assertions.