@trackunit/shared-utils 1.13.6 → 1.13.8
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.
- package/package.json +1 -1
- package/src/deepPartial.d.ts +1 -1
- package/src/typeUtils.d.ts +5 -5
package/package.json
CHANGED
package/src/deepPartial.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type DeepPartialNullable<TObject> = TObject extends Array<unknown> ? DeepPartialNullableArray<TObject[number]> : TObject extends object ? {
|
|
2
|
-
[
|
|
2
|
+
[KeyProperty in keyof TObject]?: DeepPartialNullable<TObject[KeyProperty]> | null;
|
|
3
3
|
} : TObject | null;
|
|
4
4
|
export type DeepPartialNullableArray<TItem> = Array<DeepPartialNullable<TItem>>;
|
package/src/typeUtils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Nullable<TObject> = {
|
|
2
|
-
[
|
|
2
|
+
[KeyProperty in keyof TObject]: TObject[KeyProperty] | null;
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
5
|
* Use with filter() to remove null and undefined from an array
|
|
@@ -48,7 +48,7 @@ export type MakePropertyOptional<TOriginal, KeyOfPropertyToMakeOptional extends
|
|
|
48
48
|
* @template TUnion - The type to union with each property in the original type.
|
|
49
49
|
*/
|
|
50
50
|
export type MakePropertiesUnion<TOriginal, TUnion> = {
|
|
51
|
-
[
|
|
51
|
+
[KeyProperty in keyof TOriginal]: TOriginal[KeyProperty] | TUnion;
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
54
|
* Represents a type that makes all properties of a given type optional recursively.
|
|
@@ -62,13 +62,13 @@ export type MakePropertiesUnion<TOriginal, TUnion> = {
|
|
|
62
62
|
* const user: PartialUser = { name: 'John' }; // Only 'name' is required.
|
|
63
63
|
*/
|
|
64
64
|
export type DeepPartial<TObject> = TObject extends Record<PropertyKey, unknown> ? {
|
|
65
|
-
[
|
|
65
|
+
[KeyProperty in keyof TObject]?: DeepPartial<TObject[KeyProperty]>;
|
|
66
66
|
} : TObject;
|
|
67
67
|
export type Entries<TObject> = Array<{
|
|
68
|
-
[
|
|
68
|
+
[KeyProperty in keyof TObject]: [KeyProperty, TObject[KeyProperty]];
|
|
69
69
|
}[keyof TObject]>;
|
|
70
70
|
type KeyValueTupleToObject<TEntries extends ReadonlyArray<readonly [PropertyKey, unknown]>> = {
|
|
71
|
-
[
|
|
71
|
+
[KeyEntry in TEntries[number] as KeyEntry[0]]: KeyEntry[1];
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* Converts an object into an array of properly typed key-value pairs.
|