# 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. ## Install Save in your project root: # type-fest — Essential TypeScript Utility Types Collection ## Quick Use ```bash npm install type-fest ``` ```ts import type { PartialDeep, ReadonlyDeep, SetRequired } from 'type-fest'; type Config = { db: { host: string; port: number } }; type PartialConfig = PartialDeep; // { db?: { host?: string; port?: number } } ``` ## 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 - https://github.com/sindresorhus/type-fest - https://www.npmjs.com/package/type-fest --- Source: https://tokrepo.com/en/workflows/asset-4e847fd4 Author: AI Open Source