# piotrwitek/utility-types

**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/piotrwitek-utility-types).**

5,759 stars · 235 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/piotrwitek/utility-types
- awesome-repositories: https://awesome-repositories.com/repository/piotrwitek-utility-types.md

## Topics

`mapped-types` `static-typing` `typescript` `utilities` `utility-types`

## Description

This is a TypeScript utility type library providing advanced type aliases and mapped types for complex object and union transformations. It implements specialized tools for creating branded nominal types, extracting type metadata, and performing set operations on union types.

The project distinguishes itself through a toolkit for recursive object transformations, allowing for the application of property constraints like read-only or optional status across deeply nested structures. It also provides a system for computing intersections, differences, and complements between union types to simulate mathematical set logic.

The library covers a broad range of type system capabilities, including object property filtering, shape comparison, and the extraction of class constructors and promise resolution types. It additionally includes utilities for value validation, such as detecting falsy or nullish values and identifying primitive types.

## Tags

### Software Engineering & Architecture

- [Recursive Mapped Types](https://awesome-repositories.com/f/software-engineering-architecture/recursive-type-processing/recursive-mapped-types.md) — Provides a toolkit for recursively applying property constraints across deeply nested object structures.
- [TypeScript Advanced Type Features](https://awesome-repositories.com/f/software-engineering-architecture/advanced-type-systems/typescript-advanced-type-features.md) — Implements advanced TypeScript features including generics, conditional types, and mapped types for strong type safety.
- [Mapped Type Transformations](https://awesome-repositories.com/f/software-engineering-architecture/mapped-type-transformations.md) — Implements mapped type transformations for iterating over keys to reconstruct type structures.
- [Type Intersection and Merging](https://awesome-repositories.com/f/software-engineering-architecture/type-intersection-and-merging.md) — Provides capabilities for combining multiple type definitions into a single composite structure.
- [Branded Types](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference/branded-types.md) — Implements branded types to distinguish between identical object structures using unique labels.
- [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) — Derives a union of all value types contained within an object, tuple, or array. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))

### Data & Databases

- [Recursive Property Transformations](https://awesome-repositories.com/f/data-databases/ordered-data-structures/ordered-collection-literals/object-collection-processors/object-transformation/recursive-property-transformations.md) — Enables recursive modification of properties in deep object structures to change mutability or requirement status.
- [Type-Level](https://awesome-repositories.com/f/data-databases/data-type-managers/mutable-types/mutability-modifiers/type-level.md) — Changes properties or nested structures to be either read-only or mutable via utility types. ([source](https://github.com/piotrwitek/utility-types#readme))

### Programming Languages & Runtimes

- [Object Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/object-type-transformations.md) — Recursively applies property constraints like read-only or required status to nested object structures. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))
- [Recursive Object Type Transformers](https://awesome-repositories.com/f/programming-languages-runtimes/object-type-transformations/recursive-object-type-transformers.md) — Provides a toolkit for applying property constraints like read-only or optional status to deeply nested object structures.
- [Conditional Types](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/conditional-types.md) — Provides type-level decision systems to select types based on evaluated conditions.
- [Static Type Metadata Extractors](https://awesome-repositories.com/f/programming-languages-runtimes/static-type-metadata-extractors.md) — Retrieves constructor, return, and promise resolution types from classes and functions.
- [Union Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations.md) — Provides utilities for manipulating, filtering, and aggregating properties across union types.
- [Union Member Filtering](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations/union-member-filtering.md) — Includes utilities for filtering and transforming individual members of union types.
- [Union Set Operations](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations/union-set-operations.md) — Computes mathematical set-like operations such as differences and intersections between union types.
- [Asynchronous Type Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-type-extraction.md) — Extracts the resolution type of a Promise at the type level. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))
- [Constructor Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/class-instance-type-extraction/constructor-extraction.md) — Retrieves the constructor type of a class by analyzing the type of its instances. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))
- [Object Key Extractors](https://awesome-repositories.com/f/programming-languages-runtimes/object-key-extractors.md) — Retrieves a union of object keys based on criteria like value type or mutability. ([source](https://github.com/piotrwitek/utility-types#readme))
- [Object Property Transformers](https://awesome-repositories.com/f/programming-languages-runtimes/object-property-transformers.md) — Provides utilities for filtering specific properties from objects at the type level. ([source](https://github.com/piotrwitek/utility-types#readme))
- [Shape Comparisons](https://awesome-repositories.com/f/programming-languages-runtimes/object-type-transformations/shape-comparisons.md) — Computes intersections and differences between two object types to identify shared or unique properties. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))
- [Template Literal Types](https://awesome-repositories.com/f/programming-languages-runtimes/template-literal-types.md) — Uses template literal types to generate and transform property keys at the type level.
- [Union to Intersection Converters](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations/union-to-intersection-converters.md) — Transforms a union type into an intersection type composed of all its constituent members. ([source](https://github.com/piotrwitek/utility-types/blob/master/README.md))

### Part of an Awesome List

- [Type Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/type-utilities.md) — Collection of utility types for common development patterns.
