ConfigsMay 25, 2026·3 min read

type-fest — Essential TypeScript Utility Types Collection

A curated collection of essential TypeScript types covering objects, strings, arrays, JSON, and more, maintained by Sindre Sorhus with strict typing guarantees.

Agent ready

Copy a ready-to-run agent install path

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
type-fest Overview
Direct install command
npx -y tokrepo@latest install 4e847fd4-5857-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

type-fest provides a curated, well-tested collection of TypeScript utility types that fill gaps in the built-in utility types. Maintained by Sindre Sorhus, it covers deep partial, readonly, JSON types, string manipulation, and dozens more patterns commonly needed across TypeScript projects.

What type-fest Does

  • Provides deep recursive versions of built-in types like PartialDeep and ReadonlyDeep
  • Offers strict variants of Extract, Exclude, and Omit that catch typos at compile time
  • Includes JSON-related types for parsing and serialization safety (JsonValue, JsonObject)
  • Supplies string literal manipulation types like CamelCase, KebabCase, and Split
  • Adds array utilities like FixedLengthArray, ArraySlice, and LastArrayElement

Architecture Overview

type-fest is a pure type-level library with zero runtime code. Each type is defined in its own source file, tree-shakeable by design. The library requires TypeScript 5.9 or later and strict mode enabled. Types are organized by category and exported from a single entry point for convenient imports.

Self-Hosting & Configuration

  • Install via npm: npm install type-fest
  • Import types using import type syntax only (no runtime footprint)
  • Requires strict: true in tsconfig.json
  • Requires TypeScript 5.1 or later (5.9 recommended for latest features)
  • Works with any bundler or runtime since it emits no JavaScript

Key Features

  • Over 200 carefully designed utility types
  • Zero runtime overhead since every export is a pure type
  • Strict mode variants that enforce exact key matching
  • Extensive JSDoc documentation with inline examples for every type
  • Battle-tested across thousands of npm packages

Comparison with Similar Tools

  • ts-toolbelt — larger library with 300+ types; heavier, more complex API surface
  • utility-types — smaller collection focused on mapped and conditional types; less maintained
  • ts-essentials — overlapping scope with deep partial and readonly types; fewer string utilities
  • TypeScript built-in utilities — Partial, Pick, Omit, etc.; lacks deep variants and string types
  • simplytyped — lightweight alternative; discontinued

FAQ

Q: Does type-fest add any runtime code to my bundle? A: No. Every export is a TypeScript type, removed entirely during compilation.

Q: Which TypeScript version is required? A: TypeScript 5.1 or later with strict mode enabled. Some newer types require 5.9.

Q: Can I use individual types without importing the whole package? A: Yes. Use import type { CamelCase } from 'type-fest' and your bundler will include only the type reference, which compiles away.

Q: How is PartialDeep different from the built-in Partial? A: The built-in Partial only makes top-level properties optional. PartialDeep recursively makes every nested property optional as well.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets