typescript-advanced-types

Implements generics, conditional types, mapped types, and template literals for type-safe TypeScript code.

Updated Jun 8, 2026
One-click install
npx skills add https://github.com/raulisai/eva02 --skill typescript-advanced-types-raulisai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-advanced-types
Source: https://github.com/raulisai/eva02/tree/main/.agents/skills/typescript-advanced-types
Command: npx skills add https://github.com/raulisai/eva02 --skill typescript-advanced-types-raulisai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing complex TypeScript logic without losing compile-time type safety is hard. This Skill provides patterns and guidance for building reusable generic utilities, type-safe API clients, event emitters, and validation systems so type errors are caught at compile time instead of runtime. ## Core Features & Use Cases - Advanced Type Patterns: Covers generics, conditional types, mapped types, template literal types, and built-in utility types with working examples. - Production Patterns: Includes type-safe event emitters, API clients, builders, deep readonly/partial types, form validators, and discriminated-union state machines. - Use Case: When building a NestJS API client, use the endpoint-config pattern to get fully typed request parameters, bodies, and responses for every route, so invalid calls fail at compile time. ## Quick Start Ask the AI to design a type-safe API client or generic utility for your TypeScript interfaces using the advanced types skill.

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 interface mapping event names to payload types, then use generics with keyof constraints so on() and emit() only accept valid events with correctly typed data. The compiler rejects mismatched payloads at compile time.

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. Built-in utilities ReturnType and Parameters already provide this, but custom infer patterns let you extract promise values, array elements, and nested structures.

What is the difference between mapped types and conditional types?

Mapped types iterate over an object's keys to transform properties, like Partial or Readonly. Conditional types select a type based on a check using extends, enabling logic like filtering union members or inferring inner types.

When should I use type guards instead of type assertions?

Use type guards (value is T) or assertion functions whenever narrowing unknown or union values at runtime, because assertions bypass compiler checks and can hide errors. Guards keep runtime behavior and static types in sync.

What are the limitations of complex TypeScript types?

Deeply nested conditional or recursive types slow compilation and can hit recursion depth limits. Type-level safety also does not replace runtime validation, so external data still needs schema checks at system boundaries.