typescript-advanced-types

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

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/dev-khoi/AURA-conHack-2026 --skill typescript-advanced-types-dev-khoi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript-advanced-types
Source: https://github.com/dev-khoi/AURA-conHack-2026/tree/main/.opencode/skills/typescript-advanced-types
Command: npx skills add https://github.com/dev-khoi/AURA-conHack-2026 --skill typescript-advanced-types-dev-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing type-safe TypeScript code requires mastering advanced type system features like generics, conditional types, and mapped types, which are difficult to apply correctly without concrete patterns and examples. ## Core Features & Use Cases - Advanced Type Patterns: Provides working examples of generics, conditional types, mapped types, template literal types, and utility types. - Real-World Patterns: Includes implementations of type-safe event emitters, API clients, builders, form validators, and discriminated union state machines. - Inference & Safety Techniques: Covers the infer keyword, type guards, assertion functions, branded types, and StrictOmit for safer property exclusion. - Use Case: When building a type-safe API client where request bodies and responses must be inferred from an endpoint configuration map, load the patterns context to get a complete working implementation. ## Quick Start Ask the AI to help you implement a type-safe event emitter or generic utility type in TypeScript using this skill's patterns.

Frequently Asked Questions about typescript-advanced-types

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

FAQPage Schema
How do I use generics in TypeScript functions?▼

Generics let you parameterize functions with type variables like function identity<T>(value: T): T. Follow the Golden Rule: if a type parameter appears only in the signature and not in the return type or body, replace it with a plain union type instead.

How to create a type-safe event emitter in TypeScript?▼

Define an event map type mapping event names to payload types, then use a generic class with mapped types over keyof T for the listeners registry. The on and emit methods constrain event names and payload types through generic keys.

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

Conditional types select a type based on a check using T extends U ? X : Y, while mapped types transform object types by iterating over keys with [P in keyof T]. They are often combined for filtering or remapping properties.

Does TypeScript support nominal typing for branded types?▼

TypeScript uses structural typing by default, but you can simulate nominal typing with branded types like string & { _brand: 'url' }. Combine with a type guard to validate values before assigning the brand.

Why does Omit not catch typos in excluded keys?▼

Omit<T, K> does not constrain K to keyof T, so misspelled keys pass silently. Use StrictOmit<T, K extends keyof T> = Omit<T, K> to make TypeScript report an error when the key does not exist.

When should I avoid complex conditional types in TypeScript?▼

Avoid deeply nested or recursive conditional types when they slow compilation or hurt readability. Prefer simpler types, cache complex computations, and limit recursion depth to keep build times reasonable.