@etsoo/shared 1.0.97 → 1.0.98

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/README.md CHANGED
@@ -24,6 +24,7 @@ Data type definitions and type safe functions
24
24
  |Name|Description|
25
25
  |---:|---|
26
26
  |DataType|Data type enum|
27
+ |AddOrEditType|Add or edit conditional type for same data model|
27
28
  |Basic|Basic types, includes number, bigint, Date, boolean, string|
28
29
  |BasicArray|Basic type name array|
29
30
  |BasicConditional|Conditional type based on BasicNames|
@@ -113,6 +113,10 @@ export declare namespace DataTypes {
113
113
  * Number and string combination id type
114
114
  */
115
115
  type IdType = number | string;
116
+ /**
117
+ * Add or edit conditional type for same data model
118
+ */
119
+ type AddOrEditType<T, Editing extends boolean> = Editing extends true ? T : Partial<T>;
116
120
  /**
117
121
  * Enum value type
118
122
  */
@@ -113,6 +113,10 @@ export declare namespace DataTypes {
113
113
  * Number and string combination id type
114
114
  */
115
115
  type IdType = number | string;
116
+ /**
117
+ * Add or edit conditional type for same data model
118
+ */
119
+ type AddOrEditType<T, Editing extends boolean> = Editing extends true ? T : Partial<T>;
116
120
  /**
117
121
  * Enum value type
118
122
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/shared",
3
- "version": "1.0.97",
3
+ "version": "1.0.98",
4
4
  "description": "TypeScript shared utilities and functions",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,7 +54,7 @@
54
54
  "homepage": "https://github.com/ETSOO/Shared#readme",
55
55
  "dependencies": {},
56
56
  "devDependencies": {
57
- "@types/jest": "^27.0.3",
57
+ "@types/jest": "^27.4.0",
58
58
  "@typescript-eslint/eslint-plugin": "^5.8.0",
59
59
  "@typescript-eslint/parser": "^5.8.0",
60
60
  "eslint": "^8.5.0",
package/src/DataTypes.ts CHANGED
@@ -147,6 +147,13 @@ export namespace DataTypes {
147
147
  */
148
148
  export type IdType = number | string;
149
149
 
150
+ /**
151
+ * Add or edit conditional type for same data model
152
+ */
153
+ export type AddOrEditType<T, Editing extends boolean> = Editing extends true
154
+ ? T
155
+ : Partial<T>;
156
+
150
157
  /**
151
158
  * Enum value type
152
159
  */