typescript-utility-types

Apply TypeScript utility types to resolve type-safety gaps in code.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill typescript-utility-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-utility-types
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-typescript/skills/typescript-utility-types
Command: npx skills add https://github.com/TheBushidoCollective/han --skill typescript-utility-types

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers TypeScript utility types, mapped types, conditional types, and advanced type manipulation to create flexible, type-safe code.

Core Features & Use Cases

  • Built-in utilities: Partial, Required, Pick, Omit, Readonly, Record.
  • Type manipulation: Extract, Exclude, ReturnType, Parameters.
  • Mapped types: Create expressive, type-safe interfaces.

Quick Start

Create a User type and derive a UserPreview type using Pick and an Omit version for sensitive fields.

Frequently Asked Questions about typescript-utility-types

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

FAQPage Schema
How do I use TypeScript utility types to create type-safe derived types?

TypeScript utility types like Pick, Omit, Partial, and Required enable compile-time type transformation. Use Pick to select specific properties, Omit to exclude sensitive fields, Partial to make properties optional, and Required to enforce all properties. These utilities resolve type-safety gaps by deriving new types from existing ones without runtime overhead.

What's the difference between mapped types and conditional types in TypeScript?

Mapped types iterate over object keys to transform properties systematically—use them to create Readonly versions or convert property types. Conditional types use ternary logic to branch type resolution based on constraints—use them with Extract and Exclude for selective type filtering. Both enable advanced type manipulation for complex data models.

How do I infer function return types and parameter types in TypeScript?

Use ReturnType to extract a function's return type and Parameters to capture its parameter list as a tuple. These utility types inspect callable signatures at compile time, enabling you to reuse function shapes across APIs, callbacks, and type-safe wrappers without manually duplicating type definitions.

Can I use utility types to enforce readonly contracts on API responses?

Yes. Use the Readonly utility type or mapped types with readonly modifiers to enforce immutability on object properties. This prevents accidental mutations in API responses and configuration objects, improving type safety across your TypeScript project and catching modification attempts at compile time.

When should I use Record versus mapped types for object schemas?

Use Record when you need a simple key-value type with uniform value types—ideal for configuration objects and lookup tables. Use mapped types for more complex transformations where properties need conditional logic, custom key mapping, or property-specific modifiers. Mapped types offer flexibility; Record prioritizes clarity for straightforward schemas.