explaingit

sindresorhus/type-fest

Analysis updated 2026-06-24

17,132TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

type-fest is a TypeScript library that adds dozens of missing utility types, like Merge, PartialDeep, and RequireAtLeastOne, that disappear at compile time and add nothing to your JavaScript bundle.

Mindmap

mindmap
  root((type-fest))
    What it does
      Missing TS types
      Zero runtime cost
      npm installable
    Type categories
      Object utilities
      Deep partials
      Primitive types
      Merge helpers
    Use Cases
      Shared codebases
      Strict type safety
      Complex generics
    Requirements
      TypeScript 5.9+
      ESM
      Strict mode
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Use MergeDeep to type-check the result of deeply combining two config objects without losing type information.

USE CASE 2

Use RequireAtLeastOne to enforce that a function argument must supply at least one of a set of optional properties.

USE CASE 3

Use PartialDeep to type a recursive partial update payload where any nested field may be omitted.

USE CASE 4

Copy-paste individual type definitions directly into a project without installing the package at all.

What is it built with?

TypeScript

How does it compare?

sindresorhus/type-festfoambubble/foamclauderic/dnd-kit
Stars17,13217,11717,109
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/52/53/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

type-fest is a TypeScript utility library that provides a large collection of reusable type definitions. TypeScript ships with a handful of built-in helper types like Partial, Pick, and Omit, but many other useful type shapes that developers reinvent over and over are not in the standard library. type-fest fills that gap by packaging dozens of well-tested type utilities into a single npm package. You install it with npm install type-fest and import the types you need, for example: import type Except from type-fest. There are no runtime files, the package adds nothing to your shipped JavaScript bundle because TypeScript types disappear at compile time. The author also notes you can copy-paste the type definitions directly without using the package, with no credit required. The library covers a wide surface area. Basic types include Primitive, Class, Constructor, AbstractClass, TypedArray, ObservableLike, and character matchers for letters and digits. Object utilities include EmptyObject, NonEmptyObject, UnknownRecord, Except for omitting keys, Merge and MergeDeep for combining types, MergeExclusive, RequireAtLeastOne, RequireExactlyOne, PickDeep, OmitDeep, PartialDeep, RequiredDeep, Writable, and many more. The README lists further categories beyond what is shown. You would reach for type-fest when you find yourself writing the same complex generic type by hand across multiple TypeScript projects, or when your code needs to express something subtle like an object that must have at least one of a set of keys. Requirements are TypeScript 5.9 or newer, ESM, and strict mode enabled in tsconfig. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
I'm using type-fest's Merge type to combine two TypeScript interfaces. Show me how to merge type A = { a: string, b: number } and type B = { b: string, c: boolean } so B's fields win on overlap.
Prompt 2
How do I use type-fest's RequireAtLeastOne to create a TypeScript type for a config object where the user must provide either email or phone but both are optional otherwise?
Prompt 3
Show me how to use type-fest's PartialDeep to type a recursive partial update object for a deeply nested data model in TypeScript.
Prompt 4
What is the difference between type-fest's Except and TypeScript's built-in Omit, and when should I use each one?
Prompt 5
I need to extract only the keys of a TypeScript object whose values are strings. Show me how to do this using type-fest utilities.

Frequently asked questions

What is type-fest?

type-fest is a TypeScript library that adds dozens of missing utility types, like Merge, PartialDeep, and RequireAtLeastOne, that disappear at compile time and add nothing to your JavaScript bundle.

What language is type-fest written in?

Mainly TypeScript. The stack also includes TypeScript.

How hard is type-fest to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is type-fest for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.