# sindresorhus/type-fest

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sindresorhus-type-fest).**

17,233 stars · 714 forks · TypeScript · CC0-1.0

## Links

- GitHub: https://github.com/sindresorhus/type-fest
- awesome-repositories: https://awesome-repositories.com/repository/sindresorhus-type-fest.md

## Topics

`npm-package` `types` `typescript` `typescript-definitions` `utilities`

## Description

type-fest is a library of reusable utility types for performing complex transformations and validations on objects, arrays, strings, and numeric ranges in TypeScript. It provides a collection of type definitions designed to handle advanced structural changes and constraints.

The project distinguishes itself by offering specialized logic for string literal processing, such as casing transformations and pattern-based modifications, and type-level arithmetic for calculating numeric ranges and absolute values. It also includes utilities for enforcing deep immutability, ensuring union mutual exclusivity, and extending standard configuration schemas for files like package.json.

The library covers a broad range of capabilities, including deep object manipulation, asynchronous type management, and rigorous type validation. This includes tools for JSON compatibility enforcement, character set validation, and the simplification of complex type hints to improve editor readability.

## Tags

### Software Engineering & Architecture

- [TypeScript Type Definitions](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions.md) — Offers a vast collection of TypeScript type definitions for complex structural transformations.
- [Immutability Enforcement Utilities](https://awesome-repositories.com/f/software-engineering-architecture/immutability-enforcement-utilities.md) — Provides utilities to create deeply read-only or deeply mutable versions of objects and collections. ([source](https://github.com/sindresorhus/type-fest/blob/main/readme.md))
- [Mapped Type Transformations](https://awesome-repositories.com/f/software-engineering-architecture/mapped-type-transformations.md) — Provides comprehensive mapped type transformations for iterating over object keys and modifying type structures.
- [Recursive Type Processing](https://awesome-repositories.com/f/software-engineering-architecture/recursive-type-processing.md) — Ships recursive type processing for deep operations on nested object hierarchies.
- [String Manipulation Types](https://awesome-repositories.com/f/software-engineering-architecture/string-manipulators/string-manipulation-types.md) — Implements type-level casing transformations for string literals and object keys.
- [Element Type Extraction](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/static-type-checking/type-specifications/array-element/element-type-extraction.md) — Provides a utility for retrieving the type of elements within an array or tuple. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-element.d.ts))
- [Variadic Tuple Manipulation](https://awesome-repositories.com/f/software-engineering-architecture/variadic-tuple-manipulation.md) — Provides utilities for variadic tuple manipulation, including slicing and reversing elements at the type level.
- [Element Type Validators](https://awesome-repositories.com/f/software-engineering-architecture/array-schema-validation/element-type-validators.md) — Determines if every element within an array type extends a specific target type. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/all-extend.d.ts))
- [Structural Type Validations](https://awesome-repositories.com/f/software-engineering-architecture/class-structure-definitions/structural-type-validations.md) — Checks if a value matches a specific class, constructor, or abstract class structure at the type level. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/basic.d.ts))
- [Object Field Optionality](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/data-type-validation/object-shape-validation/object-field-optionality.md) — Determines if a type contains optional properties to allow conditional logic based on field presence. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/has-optional-keys.d.ts))
- [Rigorous Type Set Operations](https://awesome-repositories.com/f/software-engineering-architecture/pattern-matching-libraries/type-aware-matching/rigorous-type-set-operations.md) — Ensures exact type matching by providing rigorous versions of Extract, Exclude, and Extends. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Type Simplification](https://awesome-repositories.com/f/software-engineering-architecture/recursive-type-processing/type-simplification.md) — Flattens complex nested type definitions into a cleaner representation for better editor readability. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/conditional-simplify-deep.d.ts))
- [Strict Empty Object Constraints](https://awesome-repositories.com/f/software-engineering-architecture/runtime-value-validation/empty-value-validations/strict-empty-object-constraints.md) — Restricts a value to be a strictly empty plain object, preventing arrays, primitives, or properties. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts))
- [Required Field Enforcement](https://awesome-repositories.com/f/software-engineering-architecture/runtime-value-validation/required-field-enforcement.md) — Determines if a given type contains any required properties to change API behavior. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/has-required-keys.d.ts))
- [Configuration Extensions](https://awesome-repositories.com/f/software-engineering-architecture/type-hint-based-schema-definitions/configuration-extensions.md) — Provides utilities to extend base type definitions for configuration files like package.json. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Intersection Flattening](https://awesome-repositories.com/f/software-engineering-architecture/type-intersection-and-merging/intersection-flattening.md) — Simplifies complex intersecting types into single object representations to improve editor hints.

### Data & Databases

- [Types](https://awesome-repositories.com/f/data-databases/ordered-data-structures/ordered-collection-literals/object-collection-processors/object-transformation/types.md) — Provides deep and shallow object transformation types for merging and omitting properties.
- [Readonly Property Detection](https://awesome-repositories.com/f/data-databases/crud-operations/readonly-column-markings/readonly-property-detection.md) — Determines if a type contains any readonly fields to conditionally change API behavior. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/has-readonly-keys.d.ts))

### Development Tools & Productivity

- [Advanced Type Validation](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/static-analysis-engines/static-analysis-tools/typescript-validators/advanced-type-validation.md) — Implements strict type checks for JSON compatibility, mutual exclusivity, and deep immutability.
- [String Case Transformers](https://awesome-repositories.com/f/development-tools-productivity/string-case-transformers.md) — Provides utility types for converting string literals and object keys between camelCase, kebab-case, snake_case, and PascalCase. ([source](https://github.com/sindresorhus/type-fest#readme))
- [String Literal Obfuscation](https://awesome-repositories.com/f/development-tools-productivity/string-literal-handling/string-literal-obfuscation.md) — Provides utilities for trimming, splitting, slicing, or removing prefixes and suffixes from string literal types. ([source](https://github.com/sindresorhus/type-fest#readme))
- [TypeScript Utility Libraries](https://awesome-repositories.com/f/development-tools-productivity/typescript-utility-libraries.md) — Acts as a comprehensive library of reusable utility types for TypeScript transformations.
- [Type Hint Simplifications](https://awesome-repositories.com/f/development-tools-productivity/developer-utilities-libraries/workflow-productivity-enhancers/developer-productivity-utilities/developer-experience/type-hint-integrations/type-hint-simplifications.md) — Flattens complex intersecting types into a single object representation to improve IDE readability and hints. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/conditional-simplify.d.ts))
- [Writable Property Detection](https://awesome-repositories.com/f/development-tools-productivity/file-writable-checks/writable-property-detection.md) — Checks if a type contains any writable properties to conditionally enable API behaviors. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/has-writable-keys.d.ts))

### Programming Languages & Runtimes

- [Generic Constraint Validation](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/generic-constraint-validation.md) — Implements strict generic constraints to ensure type safety for structures like JSON-compatible objects.
- [Numeric Type Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/generic-traits/numeric-type-traits/numeric-type-utilities.md) — Provides a set of types for type-level arithmetic and numeric range validation.
- [JSON Type Compatibility](https://awesome-repositories.com/f/programming-languages-runtimes/json-type-compatibility.md) — Ensures values match JSON-compatible structures and converts types to be assignable to JSON values. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Literal Value Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/literal-value-extraction.md) — Retrieves all literal values from a constant array or tuple to enforce type-safe index access. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-values.d.ts))
- [Object Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/object-type-transformations.md) — Removes properties from a type based on a specified condition. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/conditional-except.d.ts))
- [Type-Level Array Modifications](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-type-utilities/array-element-finding/array-modification-utilities/type-level-array-modifications.md) — Enables creating new array types by adding, removing, or replacing elements at specific index ranges. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-splice.d.ts))
- [Conditional Types](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/conditional-types.md) — Implements type-level decision systems that resolve types based on evaluated conditions. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/if.d.ts))
- [Distributive](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/conditional-types/distributive.md) — Provides advanced distributive conditional types to process union members individually.
- [Array and Tuple Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/conditional-types/tuple-and-optional-types/array-and-tuple-utilities.md) — Ships a collection of utility types for slicing arrays and extracting tuple element types.
- [String Case Transformation Types](https://awesome-repositories.com/f/programming-languages-runtimes/string-case-transformation-types.md) — Transforms top-level object keys to camel case at the type level. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/camel-cased-properties.d.ts))
- [String Literal Processing](https://awesome-repositories.com/f/programming-languages-runtimes/string-literal-processing.md) — Provides comprehensive string literal processing for casing and pattern-based modifications.
- [String Literal Type Manipulations](https://awesome-repositories.com/f/programming-languages-runtimes/string-literal-type-manipulations.md) — Implements type-level utilities for trimming, splitting, slicing, and removing prefixes or suffixes from string literal types. ([source](https://github.com/sindresorhus/type-fest/blob/main/readme.md))
- [Template Literal Types](https://awesome-repositories.com/f/programming-languages-runtimes/template-literal-types.md) — Leverages template literal types for compile-time string transformation and validation.
- [Tuple and Array Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/tuple-and-array-type-transformations.md) — Provides utilities for reversing tuples, converting them to unions, and extracting element types at the type level. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Type-Level Arithmetic](https://awesome-repositories.com/f/programming-languages-runtimes/type-level-arithmetic.md) — Implements type-level arithmetic for calculating numeric ranges and absolute values.
- [Type-Level Array Slicing](https://awesome-repositories.com/f/programming-languages-runtimes/type-level-array-slicing.md) — Extracts a subset of elements from a tuple or array type using start and end indices. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-slice.d.ts))
- [Type-Level Length Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/type-level-length-extraction.md) — Extracts the length of an array as a numeric literal or general number type. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-length.d.ts))
- [Type-Level Membership Verification](https://awesome-repositories.com/f/programming-languages-runtimes/type-level-membership-verification.md) — Determines if a specific type exists within a tuple or array for conditional type logic. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/includes.d.ts))
- [Type-Level Tuple Reversal](https://awesome-repositories.com/f/programming-languages-runtimes/type-level-tuple-reversal.md) — Reverses the order of elements in a tuple, handling both fixed-length and optional elements. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-reverse.d.ts))
- [Type Validation](https://awesome-repositories.com/f/programming-languages-runtimes/type-validation.md) — Provides general utilities for determining if a type is a literal, union, tuple, or possesses specific properties. ([source](https://github.com/sindresorhus/type-fest/blob/main/readme.md))
- [Union Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations.md) — Creates a single object type containing every possible key found across a union of object types. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/all-union-fields.d.ts))
- [Variadic Element Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/variadic-element-extraction.md) — Provides a utility for retrieving the type of the variadic element from a tuple array. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/extract-rest-element.d.ts))
- [Async Return Type Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/async-return-type-extraction.md) — Unwraps the resolved value from a function that returns a promise at the type level. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/async-return-type.d.ts))
- [Asynchronous Type Management](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-type-management.md) — Provides utilities for wrapping values in promises, unwrapping return types, and creating async versions of function types. ([source](https://github.com/sindresorhus/type-fest/blob/main/readme.md))
- [Asynchronous Type Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-type-utilities.md) — Provides utilities for wrapping values in promises and unwrapping the return types of asynchronous functions. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Configuration Schema Extensions](https://awesome-repositories.com/f/programming-languages-runtimes/configuration-schema-extensions.md) — Provides type schemas and extensions for standard configuration files like package.json.
- [Numeric Type Logic](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/generic-traits/numeric-type-traits/numeric-type-logic.md) — Generates precise numeric unions and ranges for constrained value sets.
- [Mutual Exclusivity Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/union-types/discriminated-unions/mutual-exclusivity-utilities.md) — Implements union mutual exclusivity by adding optional never types to union members. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/exclusify-union.d.ts))
- [Exact Object Type Constraints](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/type-aliases/object-aliasing/object-type-restrictions/exact-object-type-constraints.md) — Rejects arguments containing properties not explicitly declared in the target type. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/exact.d.ts))
- [Any Type Restrictions](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-safety/explicit-variable-typing/any-type-restrictions.md) — Provides a utility to detect and flag the use of the any type to enforce stricter type safety. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/is-any.d.ts))
- [Index Range Constraints](https://awesome-repositories.com/f/programming-languages-runtimes/multidimensional-arrays/advanced-array-indexing/index-boundary-validation/index-range-constraints.md) — Restricts array index values to only those that actually exist in a constant array or tuple. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/array-indices.d.ts))
- [Primitive Type Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/primitive-type-utilities.md) — Provides utility types for matching primitives, classes, constructors, and specific character sets. ([source](https://github.com/sindresorhus/type-fest#readme))
- [Standard Configuration Type Schemas](https://awesome-repositories.com/f/programming-languages-runtimes/standard-configuration-type-schemas.md) — Includes a set of predefined type schemas for standard files like package.json and tsconfig.json. ([source](https://github.com/sindresorhus/type-fest/blob/main/readme.md))
- [String Character Set Constraints](https://awesome-repositories.com/f/programming-languages-runtimes/string-character-set-constraints.md) — Restricts strings to specific subsets of the Latin alphabet, including uppercase, lowercase, digits, and alphanumeric characters. ([source](https://github.com/sindresorhus/type-fest/blob/main/source/characters.d.ts))

### Part of an Awesome List

- [Type Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/type-utilities.md) — Collection of essential and advanced type definitions.
