Sign in
Explore
Skills · SkillEveryday codingReviewed

typescript-advanced-types

TypeScript's advanced type system: generics, conditional types, mapped types and utility types.

Kind
Skill
Works with
Claude Code, Codex
Languages
TypeScript / JavaScript
Source
wshobson/agents @ 0874a27b17a2
Path
plugins/javascript-typescript/skills/typescript-advanced-types/SKILL.md
License
MIT
Jobs
Implementation
InstallInstall it from a plugin marketplace.
/plugin install javascript-typescript@claude-code-workflows
# 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:**

```typescript
function identity<T>(value: T): T {
  return value;
}

const num = identity<number>(42); // Type: number
const str = identity<string>("hello"); // Type: string
const auto = identity(true); // Type inferred: boolean
```

**Generic Constraints:**

```typescript
interface HasLength {
  length: number;
}

function logLength<T extends HasLength>(item: T): T {
  console.log(item.length);
  return item;
}
…