@alloc/types
Advanced tools
Comparing version 2.2.0 to 2.2.1
/** Try to simplify `&` out of an object type */ | ||
export type Remap<T> = {} & { | ||
[P in keyof T]: T[P] | ||
[P in keyof Extract<T, object>]: Extract<T, object>[P] | ||
} | ||
export type LoosePick<T, K> = {} & { | ||
[P in K & keyof T]: T[P] | ||
} | ||
export type Pick<T, K extends keyof T> = {} & { | ||
@@ -61,2 +65,4 @@ [P in K]: T[P] | ||
export type StringKeys<T> = string & keyof T | ||
/** Get the keys of each object type in a given union */ | ||
@@ -85,7 +91,7 @@ export type AllKeys<T> = T extends any ? keyof T : never | ||
export type Exclusive<T> = keyof T extends infer Keys | ||
? Keys extends infer Key | ||
export type Exclusive<T> = AllKeys<T> extends infer K | ||
? T extends any | ||
? Remap< | ||
{ [P in Extract<keyof T, Key>]: T[P] } & | ||
{ [P in Exclude<keyof T, Key>]?: undefined } | ||
{ [P in Extract<keyof T, K>]: T[P] } & | ||
{ [P in Exclude<K & keyof any, keyof T>]?: undefined } | ||
> | ||
@@ -92,0 +98,0 @@ : never |
{ | ||
"name": "@alloc/types", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"types": "index.d.ts", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5570
99