@naturalcycles/js-lib 14.202.0 → 14.204.0
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/dist/types.d.ts +6 -4
- package/package.json +1 -1
- package/src/types.ts +6 -6
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export type ObjectWithId = {
|
|
|
28
28
|
export type PartialObjectWithId = {
|
|
29
29
|
id?: string;
|
|
30
30
|
};
|
|
31
|
+
export interface AnyPartialObjectWithId extends AnyObject, PartialObjectWithId {
|
|
32
|
+
}
|
|
31
33
|
export interface AnyObjectWithId extends AnyObject, ObjectWithId {
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
@@ -61,10 +63,10 @@ export type BaseDBEntity = {
|
|
|
61
63
|
*/
|
|
62
64
|
updated?: UnixTimestampNumber;
|
|
63
65
|
};
|
|
64
|
-
export type Saved<T
|
|
65
|
-
export type Unsaved<T
|
|
66
|
-
export type UnsavedId<T
|
|
67
|
-
id?:
|
|
66
|
+
export type Saved<T> = T & SavedDBEntity;
|
|
67
|
+
export type Unsaved<T> = T extends AnyObject ? Omit<T, 'id' | 'created' | 'updated'> & BaseDBEntity : T;
|
|
68
|
+
export type UnsavedId<T> = Omit<T, 'id'> & {
|
|
69
|
+
id?: string;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* Convenience type shorthand.
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -39,6 +39,8 @@ export type PartialObjectWithId = {
|
|
|
39
39
|
id?: string
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export interface AnyPartialObjectWithId extends AnyObject, PartialObjectWithId {}
|
|
43
|
+
|
|
42
44
|
export interface AnyObjectWithId extends AnyObject, ObjectWithId {}
|
|
43
45
|
|
|
44
46
|
/**
|
|
@@ -80,16 +82,14 @@ export type BaseDBEntity = {
|
|
|
80
82
|
updated?: UnixTimestampNumber
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
export type Saved<T
|
|
84
|
-
? Omit<T, 'id' | 'created' | 'updated'> & SavedDBEntity
|
|
85
|
-
: T
|
|
85
|
+
export type Saved<T> = T & SavedDBEntity
|
|
86
86
|
|
|
87
|
-
export type Unsaved<T
|
|
87
|
+
export type Unsaved<T> = T extends AnyObject
|
|
88
88
|
? Omit<T, 'id' | 'created' | 'updated'> & BaseDBEntity
|
|
89
89
|
: T
|
|
90
90
|
|
|
91
|
-
export type UnsavedId<T
|
|
92
|
-
id?:
|
|
91
|
+
export type UnsavedId<T> = Omit<T, 'id'> & {
|
|
92
|
+
id?: string
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|