Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utility-types

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utility-types

Utility Types Collection for TypeScript

  • 3.11.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is utility-types?

The utility-types package provides a collection of utility types for TypeScript, which can be used to manipulate and transform type definitions in a type-safe manner. It includes types for common operations like picking, omitting, and mapping properties of other types, as well as more advanced utility types for conditional types, type inference, and more.

What are utility-types's main functionalities?

Transformation Types

Transformation types allow you to create new types based on existing ones by picking, omitting, or modifying their properties. For example, $Keys<T> extracts the keys of an object type T.

{"$Keys<T>": "Extracts the keys of an object type T as a union of literal types."}

Conditional Types

Conditional types enable you to create types that depend on a condition. For instance, $Diff<T, U> creates a type by removing properties from T that are also in U.

{"$Diff<T, U>": "Computes the set difference of types T and U, essentially removing properties from T that are in U."}

Mapped Types

Mapped types allow you to create new types by transforming properties of an existing type. $Call<F, T> is used to infer the return type of a function type F.

{"$Call<F, T>": "Infers the return type of a function type F when called with arguments of type T."}

Type Inference Helpers

Type inference helpers assist in inferring types within other types. $ElementType<T, K> extracts the type of property K from type T.

{"$ElementType<T, K>": "Extracts the type of a property K from type T."}

Other packages similar to utility-types

Keywords

FAQs

Package last updated on 18 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc