Comparing version 2.5.4 to 2.5.5
@@ -17,5 +17,5 @@ /** | ||
*/ | ||
type DeepRequiredObject<T> = { | ||
[P in keyof T]-?: DeepRequired<NonNullable<T[P]>> | ||
}; | ||
type DeepRequiredObject<T> = T extends object | ||
? {[P in keyof T]-?: DeepRequired<NonNullable<T[P]>>} | ||
: T; | ||
@@ -45,17 +45,7 @@ /** | ||
*/ | ||
type UnboxDeepRequired<T> = T extends string | ||
? string | ||
: T extends number | ||
? number | ||
: T extends boolean | ||
? boolean | ||
: T extends symbol | ||
? symbol | ||
: T extends bigint | ||
? bigint | ||
: T extends DeepRequiredArray<infer R> | ||
? Array<R> | ||
: T extends (...args: infer A) => DeepRequired<infer R> | ||
? (...args: A) => UnboxDeepRequired<R> | ||
: T extends DeepRequiredObject<infer R> ? R : T; | ||
type UnboxDeepRequired<T> = T extends DeepRequiredArray<infer R> | ||
? Array<R> | ||
: T extends (...args: infer A) => DeepRequired<infer R> | ||
? (...args: A) => UnboxDeepRequired<R> | ||
: T extends DeepRequiredObject<infer R> ? R : T; | ||
@@ -62,0 +52,0 @@ /** |
@@ -77,1 +77,14 @@ import idx, {IDXOptional} from './idx'; | ||
}); | ||
it('can unbox enums', () => { | ||
enum Enum { | ||
ONE = 'ONE', | ||
} | ||
type WithEnum = { | ||
foo?: { | ||
enum?: Enum; | ||
}; | ||
}; | ||
let e: IDXOptional<Enum> = idx({} as WithEnum, _ => _.foo.enum); | ||
}); |
{ | ||
"name": "idx", | ||
"version": "2.5.4", | ||
"version": "2.5.5", | ||
"description": "Utility function for traversing properties on objects and arrays.", | ||
@@ -25,3 +25,4 @@ "main": "lib/idx.js", | ||
"flow-bin": "^0.92.1", | ||
"jest": "^19.0.2" | ||
"jest": "^19.0.2", | ||
"typescript": "^3.3.3333" | ||
}, | ||
@@ -32,3 +33,3 @@ "jest": { | ||
}, | ||
"gitHead": "361d07e4979cf7b2b53ad79481411dc1b11dc96a" | ||
"gitHead": "e66b4a6bd1873479d261ba96e3a3ef5c6855bdaf" | ||
} |
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
12416
240
7