@augment-vir/common 29.1.7 → 29.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { RemovePartial } from './object';
|
|
1
2
|
/** @deprecated This is the same as hasKey */
|
|
2
3
|
export declare function isKeyof<ObjectGeneric>(key: PropertyKey, object: ObjectGeneric): key is keyof ObjectGeneric;
|
|
3
|
-
export declare function getObjectTypedKeys<ObjectGeneric
|
|
4
|
-
export declare function getObjectTypedValues<ObjectGeneric
|
|
5
|
-
export declare function getObjectTypedEntries<ObjectGeneric
|
|
4
|
+
export declare function getObjectTypedKeys<ObjectGeneric>(input: ObjectGeneric): Array<keyof ObjectGeneric>;
|
|
5
|
+
export declare function getObjectTypedValues<ObjectGeneric>(input: ObjectGeneric): RemovePartial<ObjectGeneric>[keyof RemovePartial<ObjectGeneric>][];
|
|
6
|
+
export declare function getObjectTypedEntries<ObjectGeneric>(input: ObjectGeneric): [keyof ObjectGeneric, RemovePartial<ObjectGeneric>[keyof RemovePartial<ObjectGeneric>]][];
|
|
6
7
|
export declare function getEntriesSortedByKey(input: object): [string, unknown][];
|
|
7
8
|
export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
|
|
@@ -16,3 +16,4 @@ export type ExtractKeysWithMatchingValues<OriginalObject extends object, Matcher
|
|
|
16
16
|
export type ExcludeKeysWithMatchingValues<OriginalObject extends object, Matcher> = keyof {
|
|
17
17
|
[Prop in keyof OriginalObject as OriginalObject[Prop] extends Matcher ? never : Prop]: Prop;
|
|
18
18
|
};
|
|
19
|
+
export type RemovePartial<Input> = Input extends Partial<Record<infer K extends PropertyKey, infer V>> ? Required<Record<K, V>> : Required<Input>;
|
|
@@ -20,8 +20,8 @@ export type PickSelection<Full extends Readonly<AnyObject>, Selection extends Ge
|
|
|
20
20
|
*/
|
|
21
21
|
export type PickCollapsedSelection<Full extends Readonly<AnyObject>, Selection extends GenericSelectionSet, Depth extends TsRecursionTracker = TsRecursionStart> = Depth extends TsTooMuchRecursion ? 'Error: recursive object depth is too deep.' : KeyCount<PickSelection<Full, Selection, Depth>> extends 1 ? Selection[keyof PickSelection<Full, Selection, Depth>] extends GenericSelectionSet ? PickCollapsedSelection<Full[keyof PickSelection<Full, Selection, Depth>], Selection[keyof PickSelection<Full, Selection, Depth>], TsRecurse<Depth>> : PropertyValueType<PickSelection<Full, Selection, Depth>> : PickSelection<Full, Selection, Depth>;
|
|
22
22
|
/** Defines a selection set for the given object. */
|
|
23
|
-
export type SelectionSet<Full extends Readonly<AnyObject>, Depth extends TsRecursionTracker = TsRecursionStart> = IsAny<Full> extends true ? any : Depth extends TsTooMuchRecursion ?
|
|
24
|
-
[Key in keyof Full]: IsNever<Exclude<Full[Key], SelectionTypesToPreserve>> extends true ? boolean :
|
|
23
|
+
export type SelectionSet<Full extends Readonly<AnyObject>, Depth extends TsRecursionTracker = TsRecursionStart> = IsAny<Full> extends true ? any : Depth extends TsTooMuchRecursion ? boolean : Full extends ReadonlyArray<infer FullChild extends AnyObject> ? SelectionSet<FullChild, TsRecurse<Depth>> : Partial<{
|
|
24
|
+
[Key in keyof Full]: IsNever<Exclude<Full[Key], SelectionTypesToPreserve>> extends true ? boolean : UnionToIntersection<SelectionSet<NonNullable<Required<Full>[Key]>, TsRecurse<Depth>>> | boolean;
|
|
25
25
|
}>;
|
|
26
26
|
export declare function selectFrom<Full extends AnyObject, const Selection extends SelectionSet<NoInfer<Full>>>(originalObject: Readonly<Full>, selectionSet: Readonly<Selection>): PickSelection<Full, Selection>;
|
|
27
27
|
export declare function selectCollapsedFrom<Full extends AnyObject, const Selection extends SelectionSet<NoInfer<Full>>>(originalObject: Readonly<Full>, selectionSet: Readonly<Selection>): PickCollapsedSelection<Full, Selection>;
|