@augment-vir/common
Advanced tools
Comparing version 19.6.0 to 19.7.0
@@ -0,6 +1,16 @@ | ||
import { AnyFunction } from '../function'; | ||
import { ArrayElement } from '../type'; | ||
import { NestedKeys } from './nested-keys'; | ||
type InnerPickDeep<OriginalObjectGeneric extends object, DeepKeys extends any[]> = DeepKeys extends [infer CurrentLevelPick, ...infer RemainingKeys] ? { | ||
[CurrentProp in Extract<CurrentLevelPick, keyof OriginalObjectGeneric>]: OriginalObjectGeneric[CurrentProp] extends object ? InnerPickDeep<OriginalObjectGeneric[CurrentProp], RemainingKeys> : OriginalObjectGeneric[CurrentProp]; | ||
export type InnerPickDeep<OriginalObjectGeneric, DeepKeys extends any[]> = DeepKeys extends [ | ||
infer CurrentLevelPick, | ||
...infer RemainingKeys | ||
] ? Extract<CurrentLevelPick, keyof OriginalObjectGeneric> extends never ? OriginalObjectGeneric : { | ||
[CurrentProp in Extract<CurrentLevelPick, keyof OriginalObjectGeneric>]: AnyFunction extends Extract<OriginalObjectGeneric[CurrentProp], AnyFunction> ? OriginalObjectGeneric[CurrentProp] | Exclude<OriginalObjectGeneric[CurrentProp], AnyFunction> : Array<any> extends Extract<OriginalObjectGeneric[CurrentProp], Array<any>> ? Array<InnerPickDeep<ArrayElement<Extract<OriginalObjectGeneric[CurrentProp], Array<any>>>, RemainingKeys>> | Exclude<OriginalObjectGeneric[CurrentProp], Array<any>> : ReadonlyArray<any> extends Extract<OriginalObjectGeneric[CurrentProp], ReadonlyArray<any>> ? ReadonlyArray<InnerPickDeep<ArrayElement<Extract<OriginalObjectGeneric[CurrentProp], ReadonlyArray<any>>>, RemainingKeys>> | Exclude<OriginalObjectGeneric[CurrentProp], ReadonlyArray<any>> : Extract<OriginalObjectGeneric[CurrentProp], Record<any, any>> extends never ? OriginalObjectGeneric[CurrentProp] : InnerPickDeep<Extract<OriginalObjectGeneric[CurrentProp], Record<any, any>>, RemainingKeys> | Exclude<OriginalObjectGeneric[CurrentProp], Record<any, any>>; | ||
} : DeepKeys extends [] ? OriginalObjectGeneric : DeepKeys extends [infer CurrentLevelPick] ? CurrentLevelPick extends keyof OriginalObjectGeneric ? Pick<OriginalObjectGeneric, CurrentLevelPick> : never : never; | ||
export type PickDeep<OriginalObjectGeneric extends object, DeepKeys extends NestedKeys<OriginalObjectGeneric>> = InnerPickDeep<OriginalObjectGeneric, DeepKeys>; | ||
export {}; | ||
/** | ||
* Pick nested keys with more strict type parameter requirements. However, these stricter type | ||
* parameter requirements often lead to "excessively deep" TS compiler errors. | ||
*/ | ||
export type PickDeepStrict<OriginalObjectGeneric extends object, DeepKeys extends NestedKeys<OriginalObjectGeneric>> = InnerPickDeep<OriginalObjectGeneric, DeepKeys>; | ||
/** Pick nested keys. */ | ||
export type PickDeep<OriginalObjectGeneric extends object, DeepKeys extends PropertyKey[]> = InnerPickDeep<OriginalObjectGeneric, DeepKeys>; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "19.6.0", | ||
"version": "19.7.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -5,0 +5,0 @@ "bugs": { |
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
160096
3840