Socket
Socket
Sign inDemoInstall

@alloc/types

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alloc/types - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

29

index.d.ts

@@ -52,15 +52,22 @@ /** Try to simplify `&` out of an object type */

/** Intersect a union of objects but merge property types with _unions_ */
export type ObjectFromUnion<T extends object> = Remap<
{
[P in keyof Intersect<T>]: T extends infer U
? P extends keyof U
? U[P]
: never
: never
}
>
/** Get the keys of each object type in a given union */
export type AllKeys<T> = T extends any ? keyof T : never
/** Merge all object types in a given union. Property types are unioned. */
export type CombineObjects<T> = [AllKeys<T>] extends [infer U]
? { [P in U & string]: CombineProp<T, P> }
: never
/**
* Given a union of object types, find which ones contain the given
* property and merge their types with a union.
*/
export type CombineProp<T, P extends string> = T extends any
? P extends keyof T
? T[P]
: never
: never
/** Convert a union to an intersection */
type Intersect<U> = (U extends any
export type Intersect<U> = (U extends any
? (k: U) => void

@@ -67,0 +74,0 @@ : never) extends (k: infer I) => void

{
"name": "@alloc/types",
"version": "2.0.0",
"version": "2.1.0",
"types": "index.d.ts",

@@ -5,0 +5,0 @@ "files": [

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