utility-types
Collection of utility types, complementing TypeScript built-in mapped types and aliases (think "lodash" for static types).
Utility-types is a TypeScript package that provides a large collection of extra type helpers for use in TypeScript projects. TypeScript already ships with a set of built-in helpers, such as Partial (which makes all fields of a type optional) and Readonly (which prevents modifications). This library extends that set with many more, covering common scenarios the built-in types do not address.
The types are organized into a few categories. Some work on object shapes, letting you pick or omit fields based on their value types, create deeply nested versions of Partial or Readonly, or find the difference and intersection between two object types. Others work on union types, which are a way of expressing that a value could be one of several types. There are also helpers for working with functions, promises, and class instances.
A separate section of the library mirrors types from Flow, a different type-checking tool for JavaScript. This makes it easier for teams migrating a Flow-typed codebase to TypeScript, since they can swap the type names without rewriting the logic.
The library has no runtime cost. The types only exist at the TypeScript level and are erased when the code is compiled to JavaScript, so adding this package does not add any code to your final application bundle. It has no third-party dependencies, which keeps it small and avoids supply-chain concerns.
Installation is a single npm or Yarn command. The README is extensive and documents every type in the collection with usage examples, which makes it easy to browse and find what you need. The package has been downloaded heavily and is tested for type correctness using a dedicated type-testing library called dts-jest. It is released under an open-source license.