@etsoo/shared 1.2.56 → 1.2.58

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/src/DataTypes.ts CHANGED
@@ -191,7 +191,8 @@ export namespace DataTypes {
191
191
  D extends string = "id"
192
192
  > =
193
193
  | (Omit<T, D> & { [key in D]?: undefined | never })
194
- | (Partial<T> & Readonly<Pick<T, D>> & { changedFields?: string[] });
194
+ | (Partial<T> &
195
+ Readonly<Pick<T, D>> & { changedFields?: (keyof T & string)[] });
195
196
 
196
197
  /**
197
198
  * Add or edit conditional type
@@ -203,7 +204,8 @@ export namespace DataTypes {
203
204
  D extends string = "id" // Default is 'id' field
204
205
  > = E extends false
205
206
  ? Optional<T, D>
206
- : Partial<T> & Readonly<Pick<T, D>> & { changedFields?: string[] };
207
+ : Partial<T> &
208
+ Readonly<Pick<T, D>> & { changedFields?: (keyof T & string)[] };
207
209
 
208
210
  /**
209
211
  * Key collection, like { key1: {}, key2: {} }
package/src/Utils.ts CHANGED
@@ -261,6 +261,8 @@ String.prototype.removeNonLetters = function (this: string) {
261
261
  * Utilities
262
262
  */
263
263
  export namespace Utils {
264
+ const IgnoredProperty = "changedFields" as const;
265
+
264
266
  /**
265
267
  * Add blank item to collection
266
268
  * @param options Options
@@ -397,7 +399,7 @@ export namespace Utils {
397
399
  }
398
400
 
399
401
  /**
400
- * Get data changed fields with input data updated
402
+ * Get data changed fields (ignored changedFields) with input data updated
401
403
  * @param input Input data
402
404
  * @param initData Initial data
403
405
  * @param ignoreFields Ignore fields
@@ -407,13 +409,13 @@ export namespace Utils {
407
409
  input: T,
408
410
  initData: object,
409
411
  ignoreFields: string[] = ["id"]
410
- ): (keyof T & string)[] {
412
+ ): Exclude<keyof T & string, typeof IgnoredProperty>[] {
411
413
  // Changed fields
412
- const changes: (keyof T & string)[] = [];
414
+ const changes: Exclude<keyof T & string, typeof IgnoredProperty>[] = [];
413
415
 
414
416
  Object.entries(input).forEach(([key, value]) => {
415
417
  // Ignore fields, no process
416
- if (ignoreFields.includes(key)) return;
418
+ if (key === IgnoredProperty || ignoreFields.includes(key)) return;
417
419
 
418
420
  // Compare with init value
419
421
  const initValue = Reflect.get(initData, key);
package/tsconfig.cjs.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "declaration": true,
11
11
  "strict": true,
12
12
  "esModuleInterop": true,
13
- "skipLibCheck": false,
13
+ "skipLibCheck": true,
14
14
  "forceConsistentCasingInFileNames": true,
15
15
  "lib": ["dom", "dom.iterable", "ESNext"]
16
16
  },
package/tsconfig.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "declaration": true,
11
11
  "strict": true,
12
12
  "esModuleInterop": true,
13
- "skipLibCheck": false,
13
+ "skipLibCheck": true,
14
14
  "forceConsistentCasingInFileNames": true,
15
15
  "lib": ["dom", "dom.iterable", "esnext"]
16
16
  },