Comparing version 0.1.11 to 0.1.12
@@ -32,2 +32,28 @@ import {IsEqual} from './comparison'; | ||
type __KeyOfValueContainingType< | ||
TObject extends object, | ||
TKey extends keyof TObject, | ||
TValue | ||
> = TKey extends keyof TObject | ||
? TValue extends TObject[TKey] ? TKey : never | ||
: never; | ||
export type KeyOfValueContainingType< | ||
TObject extends object, | ||
TValue | ||
> = __KeyOfValueContainingType<TObject, keyof TObject, TValue>; | ||
type __KeyOfValueNotContainingType< | ||
TObject extends object, | ||
TKey extends keyof TObject, | ||
TValue | ||
> = TKey extends keyof TObject | ||
? TValue extends TObject[TKey] ? never : TKey | ||
: never; | ||
export type KeyOfValueNotContainingType< | ||
TObject extends object, | ||
TValue | ||
> = __KeyOfValueNotContainingType<TObject, keyof TObject, TValue>; | ||
// Extract values | ||
@@ -62,2 +88,28 @@ | ||
type __ValueContainingType< | ||
TObject extends object, | ||
TKey extends keyof TObject, | ||
TValue | ||
> = TKey extends keyof TObject | ||
? TValue extends TObject[TKey] ? TObject[TKey] : never | ||
: never; | ||
export type ValueContainingType< | ||
TObject extends object, | ||
TValue | ||
> = __ValueContainingType<TObject, keyof TObject, TValue>; | ||
type __ValueNotContainingType< | ||
TObject extends object, | ||
TKey extends keyof TObject, | ||
TValue | ||
> = TKey extends keyof TObject | ||
? TValue extends TObject[TKey] ? never : TObject[TKey] | ||
: never; | ||
export type ValueNotContainingType< | ||
TObject extends object, | ||
TValue | ||
> = __ValueNotContainingType<TObject, keyof TObject, TValue>; | ||
export type ValueOfKey< | ||
@@ -99,2 +151,17 @@ TObject extends object, | ||
export type KeepValueContainingType<TObject extends object, TValue> = { | ||
[K in KeyOfValueContainingType<TObject, TValue>]: TObject[K] | ||
}; | ||
export type OmitValueContainingType<TObject extends object, TValue> = { | ||
[K in KeyOfValueNotContainingType<TObject, TValue>]: TObject[K] | ||
}; | ||
// Optionalize values | ||
export type OptionalizeUndefined<TObject extends object> = Partial< | ||
KeepValueContainingType<TObject, undefined> | ||
> & | ||
OmitValueContainingType<TObject, undefined>; | ||
// Miscellaneous | ||
@@ -101,0 +168,0 @@ |
{ | ||
"name": "tslang", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "TypeScript Language Type Utilities.", | ||
@@ -17,8 +17,8 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@magicspace/configs": "^0.1.24", | ||
"prettier": "^1.14.2", | ||
"tslint": "^5.11.0", | ||
"@magicspace/configs": "^0.1.46", | ||
"prettier": "^1.15.3", | ||
"tslint": "^5.12.1", | ||
"tslint-language-service": "^0.9.9", | ||
"typescript": "^3.0.1" | ||
"typescript": "^3.2.4" | ||
} | ||
} |
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
6256
170